# 有索引的 表 delimiter // CREATE PROCEDURE `proc_students`() Begin Declare n int default 1; while n<=500000 do Insert into students values(n, concat('zhang san',n),floor(1+rand()*2),floor(1+rand()*4)); Set n=n+1;
为了方便本次没有使用SQL语句,而是使用存储过程创建数据,简单快速也方便。 # 创建 存储过程 create procedure insert_user_data() begin declare i int ; declare name varchar(20); declare phone_num varchar(11); set @SURNAME = '王李张刘陈杨黄赵吴周徐孙马朱胡郭何高林罗郑梁谢宋唐位许韩冯邓曹彭曾...
AI代码解释 DELIMITER//CREATEDEFINER=`root`@`localhost`PROCEDURE`insert_table_s2`(INmin_numINT(10),INmax_numINT(10))BEGINDECLAREiINTDEFAULT0;SETautocommit=0;REPEATSETi=i+1;INSERTINTOs2VALUES((min_num+i),rand_string2(6),(min_num+30*i+5),rand_string2(6),rand_string2(10),rand_string2...
explain select count(*) from students a inner join dept b on a.dept_>explain select count(*) from students_noindex a inner join dept b on a.dept_>select SQL_NO_CACHE count(*) from students a inner join dept b on a.dept_>select SQL_NO_CACHE count(*) from students_noindex a inner...
CREATE PROCEDURE `proc_students_noindex`() Begin Declare nintdefault1; whilen<=500000do Insertintostudents_noindex values(n, concat('zhang san',n),floor(1+rand()*2),floor(1+rand()*4)); Set n=n+1; Endwhile; End; // delimiter ; ...
CREATE PROCEDURE insert_s1 (IN min_num INT (10),IN max_num INT (10)) BEGIN DECLARE i INT DEFAULT 0; SET autocommit = 0; REPEAT SET i = i + 1; INSERT INTO s1 VALUES( (min_num + i), rand_string1(6), (min_num + 30 * i + 5), ...
DELIMITER // CREATE PROCEDURE insert_s1 (IN min_num INT (10), IN max_num INT(10)) BEGIN DECLARE i INT DEFAULT 0; SET autocommit = 0; REPEAT SET i = i + 1; INSERT INTO s1 VALUES( (min_num + i), rand_string(6), (min_num + 30* i + 5), rand_string(6), rand_string(...
drop procedure if exists insert_emp;delimiter ;;create procedure insert_emp()begindeclare i int;set i=1;while(i<=100000)doinsert into employees(name,age,position) values(CONCAT('zhenghuisheng',i),i,'dev');set i=i+1;end while;end;;delimiter ;call insert_emp(); ...
1CREATE DEFINER=`root`@`localhost` PROCEDURE `generateBigDataGroup`(IN num INT) 2BEGIN 3 #Routine body goes here... 4 DECLARE i INT DEFAULT 1; 5 6 #当i小于传入的参数时执行循环插入 7 WHILE i <= num DO 8 INSERT INTO `big_data_group`(`group_code`, `number_of_people`, `gmt_crea...
CREATE PROCEDURE insert_s2 (IN min_num INT (10),IN max_num INT (10)) BEGIN DECLARE i INT DEFAULT 0; SET autocommit = 0; REPEAT SET i = i + 1; INSERT INTO s2 VALUES( (min_num + i), rand_string1(6), (min_num + 30 * i + 5), ...