时间:2021-07-01 10:21:17 帮助过:2人阅读
批量删除:
DELETE FROM MyTable WHERE ID IN (1,2);
批量插入:
INSERT INTO MyTable(ID,NAME) VALUES(1,‘123‘);
INSERT INTO MyTable(ID,NAME) VALUES(2,‘456‘);
INSERT INTO MyTable(ID,NAME) VALUES(3,‘789‘);
第二种方法,使用UNION ALL来进行插入操作:
INSERT INTO MyTable(ID,NAME)
SELECT 4,‘000‘
UNION ALL
SELECT 5,‘001‘
UNION ALL
SELECT 6,‘002‘ ;
据说要比第一种要快!
SQL小技巧
标签: