mater:lc> REPLACE INTO test (col_1,col_2) values('a','a')
Query OK, 1 row affected (0.00 sec) --注意,这里是影响了1条记录
master:lc> REPLACE INTO test (col_1,col_2) values('b','b')
Query OK, 1 row affected (0.00 sec) --注意,这里是影响了1条记录
master:lc> REPLACE INTO test (col_1,col_2) values('c','c')
Query OK, 1 row affected (0.00 sec) --注意,这里是影响了1条记录
master > show create table test
| test | CREATE TABLE `test` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`col_1` varchar(100) DEFAULT NULL,
`col_2` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `col_1` (`col_1`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 |
slave > show create table test
| test | CREATE TABLE `test` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`col_1` varchar(100) DEFAULT NULL,
`col_2` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `col_1` (`col_1`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 |