新聞中心
MySQL修改表結(jié)構(gòu)包含諸多的功能,下面介紹的MySQL修改表結(jié)構(gòu)操作實現(xiàn)的是字段的添加及刪除等,如果您對MySQL修改表結(jié)構(gòu)方面感興趣的話,不妨一看。

MySQL修改表結(jié)構(gòu)--添加字段:
alter table `user_movement_log`
Add column GatewayId int not null default 0 AFTER `Regionid` (在哪個字段后面添加)
MySQL修改表結(jié)構(gòu)--刪除字段:
alter table `user_movement_log` drop column Gatewayid
調(diào)整字段順序:
ALTER TABLE `user_movement_log` CHANGE `GatewayId` `GatewayId` int not null default 0 AFTER RegionID
//主鍵
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//增加一個新列
alter table t2 add d timestamp;
alter table infos add ex tinyint not null default ’0′;
//刪除列
alter table t2 drop column c;
//重命名列
alter table t1 change a b integer;
//改變列的類型
alter table t1 change b b bigint not null;
alter table infos change list list tinyint not null default ’0′;
//重命名表
alter table t1 rename t2;
【編輯推薦】
10大常用MySQL命令行
使用MySQL命令行修改密碼
MySQL用戶權(quán)限的取消
授予MySQL用戶權(quán)限的命令
mysql索引比較分析
文章標(biāo)題:MySQL修改表結(jié)構(gòu)--添加刪除字段
當(dāng)前地址:http://m.fisionsoft.com.cn/article/cossehi.html


咨詢
建站咨詢
