As the documentation says:
REPLACE works 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.
More Related Contents:
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- Error Code: 2013. Lost connection to MySQL server during query
- MySQL Trigger after update only if row has changed
- difference between primary key and unique key
- MySQL Query to select data from last week?
- Using an Alias in SQL Calculations
- Can a table field contain a hyphen?
- Adding a leading zero to some values in column in MySQL
- How do I add a custom CHECK constraint on a MySQL table?
- View’s SELECT contains a subquery in the FROM clause
- Can MySQL replace multiple characters?
- Check for x consecutive days – given timestamps in database
- MySQL Insert Into from one Database in another
- How do I get the ID of multiple inserted rows in MySQL?
- How to insert data to MySQL with auto-incremented column(field)?
- Case statement in MySQL
- How to produce “phantom read” in REPEATABLE READ? (MySQL)
- Laravel join with 3 Tables
- Difference between two table structure
- MySQL query, MAX() + GROUP BY
- Alternative to using LIMIT keyword in a SubQuery in MYSQL
- How to insert a file in MySQL database?
- How to get multiple records against one record based on relation?
- MySQL equivalent of Oracle’s SEQUENCE.NEXTVAL
- Foreign key constraints: When to use ON UPDATE and ON DELETE
- How to use a user variables in MySQL LIKE clause?
- MySQL for replace with wildcard
- Selecting distinct 2 columns combination in mysql
- How to store a one to many relation in MySQL database?
- MySQL – Complexity of: SELECT COUNT(*) FROM MyTable;