-- -------------------------------------------------------------------------------- -- Routine DDL -- Note: comments before and after the routine body will not be stored by the server -- ---------------------------------------------------------------
DROP TABLE IF EXISTS TeachersInfo; CREATE TABLE TeachersInfo ( id INT NOT NULL AUTO_INCREMENT, teacherCode VARCHAR(20) NULL, teacherName VARCHAR(30) NULL, roleID VARCHAR(20) NULL, SUBJECT INT NULL, CONSTRAINT PK_TEACHERSINFO PRIMARY KEY clustered (id
mysql需要导入某前缀例如12345为前缀的,后缀扩展2位 即00-99. 利用存储过程插入数据. DROP PROCEDURE IF EXISTS insert_popsms_code;DELIMITER // ) ) BEGIN ; DECLARE channelId int; ); do ) then ',i); else set codeNum = CONCAT(prefix,i); end if; ' ) then ; ELSEIF(prefix ') then ; else ; e
经常需要测试数据,写个存储过程方便日后使用. DROP PROCEDURE IF EXISTS add_member; DELIMITER $$ CREATE PROCEDURE add_member (IN loop_times INT) BEGIN ; WHILE member_account < loop_times DO ; INSERT INTO t_member ( member_name, member_password ) VALUES ( member_account, 'e1
参考:https://www.iteye.com/blog/825635381-2161290 场景1.创建1万个table,每个table种插入1条记录 DELIMITER $$ CREATE DATABASE `lr_test` $$ USE `lr_test` $$ DROP PROCEDURE IF EXISTS `cyc` $$ CREATE PROCEDURE `cyc`( ) BEGIN DECLARE i INT; DECLARE MAX INT DEFAULT 10000; D
DELIMITER //CREATE PROCEDURE p_addscore(nums INT,OUT retrows INT)BEGINDECLARE i INT DEFAULT 0;add_loop:LOOP IF i >= nums THEN LEAVE add_loop; END IF; INSERT s_musicscore (ssid,uid,score,ctime,stype) VALUES(17,UUID(),8,UNIX_TIMESTAMP(),1); SET i=i+1;E