REPLACE in Mysql

REPLACE in Mysql

REPLACE is exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted.
REPLACE INTO is a much slower performer than an UPDATE statement.We need REPLACE INTO when we have multiple unique constraints on a table, and need to drop any rows that would match any of the constraints.

Syntax :
REPLACE INTO [tbl_name] SET [col1_name]=[value1], [col2_name]=[value2],…

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.