Entry
Does REPLACE have a multi-row form like INSERT?
Feb 25th, 2000 17:13
Nathan Wallace, Thimble Smith
Yes, here is an example:
mysql> create table table_name (id int not null auto_increment primary
-> key, name char(10));
Query OK, 0 rows affected (0.02 sec)
mysql> insert into table_name (name) values ('abc'), ('def'), ('ghi');
Query OK, 3 rows affected (0.05 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> replace into table_name (id, name) values (2, 'xyz'), (3, 'pdq');
Query OK, 4 rows affected (0.02 sec)
Records: 2 Duplicates: 2 Warnings: 0
mysql> select * from table_name;
+----+------+
| id | name |
+----+------+
| 1 | abc |
| 2 | xyz |
| 3 | pdq |
+----+------+
3 rows in set (0.02 sec)
mysql> select version();
+------------------+
| version() |
+------------------+
| 3.23.9-alpha-log |
+------------------+
1 row in set (0.00 sec)