我现在这里有一个主表,主表中有一个字段 ,我想根据这个字段拆分成多个分表。
分表字段结构与主表相同,分表名与主表字段相同即可。
根据主表字段循环建表 之后字段再循环添加主表的内容到分表
oracle 有分区语句 partition by
http://www.cnblogs.com/pengineer/p/4393988.html
复制表结构:create table table2 as select * from table1 where 1=2;
多表插入:insert first/all when column1<=10 then into table21
when column1>10 and column1<20 then into table22
else into table23
select column1,column2, from table1
如果会存储过程,可以用存储过程,会简单点。用SQL写要分多步,一条的话,即使能写出来,也可能比较复杂。