自动将值从范围插入表
问题描述:
是否可以使用MySQL语句自动将值插入表(即30到200)?
Is it possible to auto insert values into a table i.e. from 30 to 200 with MySQL statement ?
答
以下是应该执行的存储过程:
Here's a stored procedure that should do it:
CREATE PROCEDURE insert_range()
BEGIN
DECLARE i INT DEFAULT 30;
WHILE i <= 200 DO
INSERT my_table (col_with_range) VALUES (i);
SET i = i + 1;
END WHILE;
END