0

I was running some SQL queries in a siteground site. Where I have some queries like this:

ALTER TABLE `tbl_sales` ADD IF NOT EXISTS `employee_id` INT NULL DEFAULT NULL AFTER `customer_id`;

But when I run run the SQL I am getting this error.

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS employee_id INT NULL DEFAULT NULL AFTER customer_id' at line 1

But the same SQL I am running in my local and having no issue. I guess it is a MySQL version issue or something, can you please help me to solve this problem?

Here is the server information of my local:

Server type: MariaDB Server version: 10.1.22-MariaDB - mariadb.org binary distribution

And in SiteGround, it is:

Server type: MySQL Server version: 5.7.25-28-log - Source distribution

Thanks in advance!

  • there is no solution to your problem. one way is to do that in a procedure – nbk Jul 04 '20 at 19:46
  • Your local and production databases really should be the same down to the sub-version level, otherwise you can have some very nasty surprises - such as this one! Mariadb is **not** mysql, it is a fork of mysql, which is increasingly divergent from the original mysql. – Shadow Jul 04 '20 at 20:21

0 Answers0