如何固定MySQL插入?
借助以下语法,可以在同时插入多个记录时加快MySQL的插入速度
START TRANSACTION insert into insertDemo(yourColumnName1,yourColumnName2,...N) values(yourValue1,yourValue2,....N),(yourValue1,yourValue2,....N),.......N commit
让我们首先创建一个演示表
create table insertDemo -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentAge int -> );
同时插入多个记录。查询如下-
START TRANSACTION;
insert into insertDemo(StudentName,StudentAge) values('John',21),('Carol',22),('Bob',21),('David',24),
-> ('Maxwell',25),('Mike',22);
Records: 6 Duplicates: 0 Warnings: 0
commit;热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短