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

By | August 1, 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 email address will not be published. Required fields are marked *