一.橫向拆分
create table 新表的名稱 select * from 被拆分的表 order by id limit int1,int2
int1為其實位置,int2為幾條
注意:這樣拆分后主鍵會失效手動讓其主鍵生效即可所有要執行
alter table 新表的名稱 modify 主鍵欄位 int primary key auto_increment
二.縱向拆分
create table 新表的名稱 select 需保留的欄位 from 被拆分的表
拆分后原表都要保存
主要是把經常查的資料放在一個表里,不經常查的資料不做處理
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/234167.html
標籤:其他
