一.橫向拆分
create table 新表的名稱 select * from 被拆分的表 order by id limit int1,int2
int1為其實位置,int2為幾條
注意:這樣拆分后主鍵會失效手動讓其主鍵生效即可所有要執行
alter table 新表的名稱 modify 主鍵字段 int primary key auto_increment
二.縱向拆分
create table 新表的名稱 select 需保留的字段 from 被拆分的表
拆分后原表都要保存
主要是把經常查的數據放在一個表里,不經常查的數據不做處理