当前位置:网站首页>MySQL batch add test data
MySQL batch add test data
2022-07-18 02:24:00 【Code slave was born to know only to move forward~】
Catalog
1、 Create test table
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for one_data
-- ----------------------------
DROP TABLE IF EXISTS `one_data`;
CREATE TABLE `one_data` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT ' Primary key ID',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT ' name ',
`sort_number` int(11) NULL DEFAULT NULL COMMENT ' Serial number ',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT ' Creation time ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = ' Test batch insert data ' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;2、 Create stored procedure
-- Create stored procedure
CREATE PROCEDURE `addOneData`(IN n int)
BEGIN
DECLARE i INT DEFAULT 1;
WHILE (i <= n ) DO
INSERT INTO `one_data`( `name`, `sort_number`, `create_time`) VALUES (CONCAT(' Data name ',i), i, NOW());
set i=i+1;
END WHILE;
END3、 Calling stored procedure
-- call This is insert 1000 strip
CALL addOneData(1000)
边栏推荐
- tree shaking的原理是什么?
- 云呐-动环监控系统实现无人化的快速故障处理
- 【黑马早报】东方甄选CEO:董宇辉是总裁级主播;李亚鹏欠债4000万终审败诉;15家商业银行称停贷风险可控;红杉大幅减持美团...
- For collecting lost rights and interests, is it still worth digging into the content of enterprise stations?
- Matlab drawing examples
- [flag]马头琴
- 手机怎样控制led显示屏发视频?
- C # flying chess games
- STM32 and Internet of things 02 network data sending and receiving
- STM32与物联网02-网络数据收发
猜你喜欢

【黑马早报】东方甄选CEO:董宇辉是总裁级主播;李亚鹏欠债4000万终审败诉;15家商业银行称停贷风险可控;红杉大幅减持美团...

接口开发不用写Controller、Service、Dao、Mapper、XML、VO,全自动生成!

单车管理系统——1.文档设计及sql代码说明

开源实时数仓 Apache Doris 毕业了,未来如何走得更远?

Version announcement | Apache Doris 1.1 release version officially released!

Serial communication of raspberry pie

从底层结构开始学习FPGA----MMCM与PLL

Xu Shiwei: the road of go+ evolution

支付宝沙箱版app登入失败账户不存在问题

蛋糕可以一刀切,研发需求可以吗? | 敏捷实践
随机推荐
从底层结构开始学习FPGA----MMCM与PLL
Deep understanding and recognition of C language symbols
Configure the C locale of sublime
苹果和前设计总监 Jony lve 分道扬镳
Educational Codeforces Round 112 (Rated for Div. 2) D. Say No to Palindromes(前缀和+思维)
HashSet and TreeSet
Heap sort
【第018问 Unity中对Quaternion.AngleAxis的理解?】
一图看懂:国企数字化转型4个方向3个战略
Entity drop-down box design applicable to MES, WMS, ERP and other management systems
Can spiders quickly increase the collection of websites by increasing the frequency of crawling?
Dark clouds and chaos of bird's nest economy
[computer level 3 information security] time node memory test questions
泛云桌面关键技术分析
Baijiahao ranks well. How can the conversion rate be improved?
第8章 委托、lambda表达式和事件
Install opencv environment for raspberry pie to solve no module named 'CV2'
Educational codeforces round 112 (rated for Div. 2) d. say no to palindromes (prefix and + thinking)
Latex mathematical formula
Servlet api code example: server version confession wall