What are the differences between INSERT, UPDATE, REPLACE in MySql?

By | 1st August 2018

These are totally different statements.

Insert: Insert new record.
Example : INSERT INTO table(fields) VALUES(values);

Update: Update existing record
Example : UPDATE table SET fields=values Where conditions;

Replace: This syntax is the same as the INSERT. The old row is deleted before the new row is inserted.
Example : REPLACE INTO table SET fields=values;

Leave a Reply

Your e-mail address will not be published. Required fields are marked *