废话:程序员需要将数据库中的userinfo表拆分成user_coin,user,level两张表。写了一套Java程序,谁知道跑在mysql集群上就花了好几十分钟。纠结之际想到了select into语句。简单介绍着三张表
userinfo。字段userid自增长,coin int型,level int型。
user_coin。字段id自增长,userid int型,coin int型。
user_level。字段id自增长,userid int型,level int型。
mysql>use mydb
mysql>create table user_coin(select userid,coin from userinfo); //把所有的userid,coin字段填充到新表中
mysql>create table user_level(select userid,level from userinfo);//把所有的userid,level字段填充到新表中
OK...数据好了一半。。打开navicat工具。设计两张表,分别加上字段id(自增长的)。保存退出。
ok...数据拆分完毕。...
后续...最后写了一份存储过程,速度更快更方便....