复制代码 代码如下:
create table t_team
(
id int primary key,
tname varchar(100)
);
create table t_people
(
id int primary key,
pname varchar(100),
team_id int,
foreign key (team_id) references t_team(id)
);
复制代码 代码如下:
CREATE PROCEDURE createdata()
BEGIN
DECLARE i INT;
START TRANSACTION;
SET i=0;
WHILE i<1000 DO
INSERT INTO t_team VALUES(i+1,CONCAT('team',i+1));
SET i=i+1;
END WHILE;
SET i=0;
WHILE i<100000 DO
INSERT INTO t_people VALUES(i+1,CONCAT('people',i+1),i%1000+1);
SET i=i+1;
END WHILE;
COMMIT;
END
新闻热点
疑难解答