当前位置:网站首页>Mysql批量添加测试数据
Mysql批量添加测试数据
2022-07-15 10:55:00 【码奴生来只知道前进~】
目录
1、创建测试表
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 '主键ID',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '名称',
`sort_number` int(11) NULL DEFAULT NULL COMMENT '序号',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = '测试批量插入数据' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;2、创建存储过程
-- 创建存储过程
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('数据名称',i), i, NOW());
set i=i+1;
END WHILE;
END3、调用存储过程
-- 调用 这是插入1000条
CALL addOneData(1000)
边栏推荐
- Matlab中响应鼠标的事件
- Vessel introduction and summary
- matlab 画图例题篇
- [C exercise] input the month and year, and calculate the number of days in the month
- agile manifesto
- 【C】 Pointer advanced
- 2020-10-11
- Revelation of AI application: honey and arsenic in security market
- [HCIA] data communication network foundation
- 泛云桌面关键技术分析
猜你喜欢
![[C exercise] print diamond](/img/fb/3d60abbadbed41b51e76cf397407e8.png)
[C exercise] print diamond

树莓派串口通信

许式伟:Go+ 演进之路

What are the problems we need to pay attention to in setting the standard of Baidu search basic information?

机器学习预备知识:分类与回归

Install opencv environment for raspberry pie to solve no module named 'CV2'

Vessel introduction and summary

.net core 配置跨域

百度搜索基础信息设置规范,有哪些我们需要注意的问题呢?

Analysis of problems related to C language pointer
随机推荐
【C】 Pointer advanced
Idea setting / modifying shortcut keys
解析协同办公“协同”为何意,数字化办公又如何轻松“破题”?
Introduction to redis
owt-server源码剖析(二)--功能模块的内部结构与启动流程
Codeforces Round #736 (Div. 2) (A-D)
树莓派 安装 opencv 环境,解决NO module named ‘cv2’
[exercise C] drink soda
Software testing W model
C WinForm form form basic properties
HashSet and TreeSet
Servlet api code example: server version confession wall
[C exercise] print all "Narcissus numbers" from 0 to 100000
全球No.1港航人工智能AI企业中集飞瞳,港航人工智能产品成熟化标准化大规模应用,为港口大幅提效降本,提升港区效能,优化港区次序
第四十二期:所谓的管理团队
What is the difference between VDD, VCC, VSS, GND and ground?
Raspberry pie remote desktop display is incomplete
Analyze the meaning of "collaboration" in collaborative office, and how can digital office easily "solve the problem"?
Which is more suitable to be an advanced anti DDoS server, cloud server or physical machine
Engineering monitoring vibrating wire sensor wireless acquisition instrument external digital sensor