一、创建测试表
1.创建唯一索引”b”
CREATE TABLE `test2` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`a` varchar(5) DEFAULT NULL,
`b` varchar(5) DEFAULT NULL,
`c` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_b` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf
2.插入3条数据
INSERT INTO test1(a,b,c) VALUE (1,2,3),(2,4,4),(2,3,5);
select * from tset2;
二、replace into用法
1.使用replace into插入单条数据
REPLACE INTO test2(b,c) VALUE (3,3);
2 row(s) affected
Execution Time : 00:00:00:047
Transfer Time : 00:00:00:000
Total Time : 00:00:00:047
IN