使用SQL语句进行批量插入演示数据

使用SQL语句进行批量插入演示数据

019851

方法1:逐条执行,速度慢

INSERT INTO testimport (name, message)
VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd');

INSERT INTO testimport (name, message)
VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd');

INSERT INTO testimport (name, message)
VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd');

方法2:批量执行,适用于 SQL Server

INSERT INTO testimport (name, message)
VALUES
('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd'),
('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd'),
('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd');

方法3:批量执行,适用于Oracle

INSERT ALL 
    INTO A (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd')
    INTO A (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd')
    INTO A (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd')
SELECT 1
FROM DUAL;
© 版权声明
THE END
文章不错?点个赞呗
点赞51赞赏
分享
评论 抢沙发
小语雀的头像-小语雀网

昵称

取消
昵称表情代码图片