Is merge statement available in MySQL

MERGE is not supported by MySQL, However, there is other possible way of doing the same: INSERT…ON DUPLICATE KEY UPDATE If you specify the ON DUPLICATE KEY UPDATE option in the INSERT statement and the new row causes a duplicate value in the UNIQUE or PRIMARY KEY index, MySQL performs an update to the old row … Read more

How To have Dynamic SQL in MySQL Stored Procedure

I don’t believe MySQL supports dynamic sql. You can do “prepared” statements which is similar, but different. Here is an example: The prepared statements are often used to see an execution plan for a given query. Since they are executed with the execute command and the sql can be assigned to a variable you can approximate the some of … Read more

How to remove index.php from WordPress site URL

Go to your WP-ADMIN–>Settings–>Permalink and use the permalink structure change there, if it generate any .htaccess file copy the content and update your .htaccess file. Or Check if your hosting mod_rewrite is enable by creating a file phpinfo.php with content, Upload this file and browse via Browser. So you know which modules are enabled. You … Read more

How to insert TIMESTAMP into my MySQL table?

In addition to checking your table setup to confirm that the field is set to NOT NULL with a default of CURRENT_TIMESTAMP, you can insert date/time values from PHP by writing them in a string format compatible with MySQL. This will give you the current date and time in a string format that you can insert into MySQL.

MySQL Error #1071 – Specified key was too long; max key length is 767 bytes

767 bytes in MySQL version 5.6 (and prior versions), is the stated prefix limitation for InnoDB tables. It’s 1,000 bytes long for MyISAM tables. This limit has been increased to 3072 bytes In MySQL version 5.7 (and upwards). You also have to be aware that if you set an index on a big char or varchar field which is utf8mb4 encoded, you have to … Read more

There can be only one auto column

My MySQL says “Incorrect table definition; there can be only one auto column and it must be defined as a key” So when I added primary key as below it started working: