GamesRadar未來遊戲展將於6月11日舉行
阿新 • • 發佈:2022-05-21
MySQL實戰(2)
克隆表:create table newtableName like oldTableName;
2、show create table tableName \G;
表結構的維護:
1、修改表的名稱:rename table oldTableName to newTableName;
2、新增一列:alter table tableName add 欄位 欄位型別;
(1)新增至第一行:alter table tableName add xx 欄位 first;
(2)新增到xx之後:alter table tableName add xx 欄位 after xx;
3、刪除一列:alter table tableName drop 欄位;
(1)新建欄位增加備註並在建立過程中可檢視:
(2)新增在特定位置並備註:
5、修改列的型別:alter table tableName modify 欄位 欄位新的型別;
6、修改列的名稱 :alter table tableName change 舊列名 新列名 型別;
2、批量插入語句
3、指定欄位插入語句(預設不能為空的條件下,必須插入相應內容)
4.把一個表裡面的資料插入到另外一個表:
delete:
(2)truncate table tableName:針對的是千萬級別的資料,它的刪除效率是非常好的