- DROP PROCEDURE
- IF EXISTS test_data;
-
- DELIMITER $
- CREATE PROCEDURE test_data()
- BEGIN
- DECLARE i INT UNSIGNED DEFAULT 1;
- WHILE i <= 100 DO
- INSERT INTO sc (`s_id`,`c_id`,`score`) SELECT id,i,FLOOR((RAND() * 100)) FROM student;
- SET i = i+1;
- END WHILE;
- END $
-
- CALL test_data();
复制代码
|