如上,需要创建xxx_00、xxx_01...xxx_99,格式相同,有没有快速建表语句啊,不需要一个一个的创建,试了下不行CREATE TABLE xxx_00,xxx_01,xxx_02...这样是语法错误的
解决方案 »
- 在mysql数据库已有的表中新建一列,这一列的值为另外一已有数据的列的排名。 求高手sql如何写?
- 帮忙看下一个 sql 语句吧 在线等。。。。。。。。。
- 关于innodb检查点与脏页的问题
- 新手主从服务器问题,请求帮助
- 老问题变种,mysql 插入数据速度突然变慢了!
- EMSMySQLManager导入,导出问题
- 关于MYSQL语句问题?
- 菜鸟试飞~! 请问一个关于mysql的insect问题! 50分~!
- 在声明游标前使用select查询的话就会报错,这时声明原因
- python服务器代码和android studio代码可以无修改跨平台运行吗?
- 存储过程中的问题,急
- mysql查询效率比较
DELIMITER //
CREATE PROCEDURE demo_in_test(IN p_in int)
BEGIN
declare i int;
set i=0;
while i<p_in do
//这里写创建表的语句,表明当然是变化的哦
set i=i+1;
end while;
END;
do
mysql -uroot -pxxx dbname -e "create table xxx_$i(a int)"
done
DELIMITER //
CREATE PROCEDURE demo_in_test(IN p_in int)
BEGIN
declare i int;
set i=0;
while i<p_in do
set @sql=concat('create table xxx_',i,'(a int)');
prepare stmt from @sql;
execute stmt;
set i=i+1;
end while;
END;
CREATE TABLE xxx_00 (id int primary key, c int, f1 int);
CREATE TABLE xxx_01 (id int primary key, c int, f1 int);
CREATE TABLE xxx_02 (id int primary key, c int, f1 int);
CREATE TABLE xxx_03 (id int primary key, c int, f1 int);
CREATE TABLE xxx_04 (id int primary key, c int, f1 int);
CREATE TABLE xxx_05 (id int primary key, c int, f1 int);
CREATE TABLE xxx_06 (id int primary key, c int, f1 int);
CREATE TABLE xxx_07 (id int primary key, c int, f1 int);
CREATE TABLE xxx_08 (id int primary key, c int, f1 int);
CREATE TABLE xxx_09 (id int primary key, c int, f1 int);
CREATE TABLE xxx_10 (id int primary key, c int, f1 int);
CREATE TABLE xxx_11 (id int primary key, c int, f1 int);
CREATE TABLE xxx_12 (id int primary key, c int, f1 int);
CREATE TABLE xxx_13 (id int primary key, c int, f1 int);
CREATE TABLE xxx_14 (id int primary key, c int, f1 int);
CREATE TABLE xxx_15 (id int primary key, c int, f1 int);
CREATE TABLE xxx_16 (id int primary key, c int, f1 int);
CREATE TABLE xxx_17 (id int primary key, c int, f1 int);
CREATE TABLE xxx_18 (id int primary key, c int, f1 int);
CREATE TABLE xxx_19 (id int primary key, c int, f1 int);
CREATE TABLE xxx_20 (id int primary key, c int, f1 int);
CREATE TABLE xxx_21 (id int primary key, c int, f1 int);
CREATE TABLE xxx_22 (id int primary key, c int, f1 int);
CREATE TABLE xxx_23 (id int primary key, c int, f1 int);
CREATE TABLE xxx_24 (id int primary key, c int, f1 int);
CREATE TABLE xxx_25 (id int primary key, c int, f1 int);
CREATE TABLE xxx_26 (id int primary key, c int, f1 int);
CREATE TABLE xxx_27 (id int primary key, c int, f1 int);
CREATE TABLE xxx_28 (id int primary key, c int, f1 int);
CREATE TABLE xxx_29 (id int primary key, c int, f1 int);
CREATE TABLE xxx_30 (id int primary key, c int, f1 int);
CREATE TABLE xxx_31 (id int primary key, c int, f1 int);
CREATE TABLE xxx_32 (id int primary key, c int, f1 int);
CREATE TABLE xxx_33 (id int primary key, c int, f1 int);
CREATE TABLE xxx_34 (id int primary key, c int, f1 int);
CREATE TABLE xxx_35 (id int primary key, c int, f1 int);
CREATE TABLE xxx_36 (id int primary key, c int, f1 int);
CREATE TABLE xxx_37 (id int primary key, c int, f1 int);
CREATE TABLE xxx_38 (id int primary key, c int, f1 int);
CREATE TABLE xxx_39 (id int primary key, c int, f1 int);
CREATE TABLE xxx_40 (id int primary key, c int, f1 int);
CREATE TABLE xxx_41 (id int primary key, c int, f1 int);
CREATE TABLE xxx_42 (id int primary key, c int, f1 int);
CREATE TABLE xxx_43 (id int primary key, c int, f1 int);
CREATE TABLE xxx_44 (id int primary key, c int, f1 int);
CREATE TABLE xxx_45 (id int primary key, c int, f1 int);
CREATE TABLE xxx_46 (id int primary key, c int, f1 int);
CREATE TABLE xxx_47 (id int primary key, c int, f1 int);
CREATE TABLE xxx_48 (id int primary key, c int, f1 int);
CREATE TABLE xxx_49 (id int primary key, c int, f1 int);
CREATE TABLE xxx_50 (id int primary key, c int, f1 int);
CREATE TABLE xxx_51 (id int primary key, c int, f1 int);
CREATE TABLE xxx_52 (id int primary key, c int, f1 int);
CREATE TABLE xxx_53 (id int primary key, c int, f1 int);
CREATE TABLE xxx_54 (id int primary key, c int, f1 int);
CREATE TABLE xxx_55 (id int primary key, c int, f1 int);
CREATE TABLE xxx_56 (id int primary key, c int, f1 int);
CREATE TABLE xxx_57 (id int primary key, c int, f1 int);
CREATE TABLE xxx_58 (id int primary key, c int, f1 int);
CREATE TABLE xxx_59 (id int primary key, c int, f1 int);
CREATE TABLE xxx_60 (id int primary key, c int, f1 int);
CREATE TABLE xxx_61 (id int primary key, c int, f1 int);
CREATE TABLE xxx_62 (id int primary key, c int, f1 int);
CREATE TABLE xxx_63 (id int primary key, c int, f1 int);
CREATE TABLE xxx_64 (id int primary key, c int, f1 int);
CREATE TABLE xxx_65 (id int primary key, c int, f1 int);
CREATE TABLE xxx_66 (id int primary key, c int, f1 int);
CREATE TABLE xxx_67 (id int primary key, c int, f1 int);
CREATE TABLE xxx_68 (id int primary key, c int, f1 int);
CREATE TABLE xxx_69 (id int primary key, c int, f1 int);
CREATE TABLE xxx_70 (id int primary key, c int, f1 int);
CREATE TABLE xxx_71 (id int primary key, c int, f1 int);
CREATE TABLE xxx_72 (id int primary key, c int, f1 int);
CREATE TABLE xxx_73 (id int primary key, c int, f1 int);
CREATE TABLE xxx_74 (id int primary key, c int, f1 int);
CREATE TABLE xxx_75 (id int primary key, c int, f1 int);
CREATE TABLE xxx_76 (id int primary key, c int, f1 int);
CREATE TABLE xxx_77 (id int primary key, c int, f1 int);
CREATE TABLE xxx_78 (id int primary key, c int, f1 int);
CREATE TABLE xxx_79 (id int primary key, c int, f1 int);
CREATE TABLE xxx_80 (id int primary key, c int, f1 int);
CREATE TABLE xxx_81 (id int primary key, c int, f1 int);
CREATE TABLE xxx_82 (id int primary key, c int, f1 int);
CREATE TABLE xxx_83 (id int primary key, c int, f1 int);
CREATE TABLE xxx_84 (id int primary key, c int, f1 int);
CREATE TABLE xxx_85 (id int primary key, c int, f1 int);
CREATE TABLE xxx_86 (id int primary key, c int, f1 int);
CREATE TABLE xxx_87 (id int primary key, c int, f1 int);
CREATE TABLE xxx_88 (id int primary key, c int, f1 int);
CREATE TABLE xxx_89 (id int primary key, c int, f1 int);
CREATE TABLE xxx_90 (id int primary key, c int, f1 int);
CREATE TABLE xxx_91 (id int primary key, c int, f1 int);
CREATE TABLE xxx_92 (id int primary key, c int, f1 int);
CREATE TABLE xxx_93 (id int primary key, c int, f1 int);
CREATE TABLE xxx_94 (id int primary key, c int, f1 int);
CREATE TABLE xxx_95 (id int primary key, c int, f1 int);
CREATE TABLE xxx_96 (id int primary key, c int, f1 int);
CREATE TABLE xxx_97 (id int primary key, c int, f1 int);
CREATE TABLE xxx_98 (id int primary key, c int, f1 int);
CREATE TABLE xxx_99 (id int primary key, c int, f1 int);
你这做法跟我公司一位同仁很相似,每次更新或者是insert数据他就用excel生成几千行的代码,然后执行。