mysql一次插入多条demo测试用数据实战分享
程序员文章站
2022-03-09 22:03:21
1.傻傻的insert
insert into raw_materials.common_picture_setting
(picture_setting_name,picture_setti...
1.傻傻的insert
insert into raw_materials.common_picture_setting (picture_setting_name,picture_setting_url,picture_setting_type,picture_setting_enabled,picture_setting_explain,platform_type) values ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null), ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null), ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null), ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null), ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null), ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null)
2.使用一个存储过程
delimiter // create procedure init_demo300_data() begin declare n int default 0; while(n<=300) do insert into raw_materials.common_picture_setting (picture_setting_name,picture_setting_url,picture_setting_type,picture_setting_enabled,picture_setting_explain,platform_type) values ('logo-v3','https://gss2.bdstatic.com/-fo3dsag_xi4khgkpowk1hf6hhy/baike/c0%3dbaike150%2c5%2c5%2c150%2c50/sign=5ad4d0a4c5bf6c81e33a24badd57da50/9345d688d43f879462947ce2db1b0ef41ad53a96.jpg',2,1,'广告位轮播图5张(默认图)',null); set n = n + 1; end while; end // delimiter ; call init_demo300_data();