当前位置:Gxlcms > 数据库问题 > MySQL 字段常用操作 添加,修改,删除,调整字段顺序

MySQL 字段常用操作 添加,修改,删除,调整字段顺序

时间:2021-07-01 10:21:17 帮助过:2人阅读

table appstore_souapp_app_androidmarket Add column getPriceCurrency varchar(50) default null AFTER getPrice

修改字段
alter table表名
change 字段名 新字段名 字段类型 默认值

例子:

alter table appstore_souapp_app_androidmarket change hasPrice hasPrice varchar(10)  null;
ALTER TABLE xshop_update_fail CHANGE bill_no bill_no BIGINT(20) UNSIGNED NULL COMMENT 系统订单号

删除字段
alter table 表名 drop column 字段名

例子:

alter table appstore_souapp_app_androidmarket<BR>drop column getPriceCurrency

调整字段顺序
alter table 表名
change 字段名 新字段名 字段类型 默认值 after 字段名(跳到哪个字段之后)

例子:

alter table appstore_souapp_app_androidmarket<BR>change getPriceCurrency 
getPriceCurrency varchar(50)&nbsp;&nbsp; default null AFTER getPrice

 

原文:http://blog.csdn.net/changemyself/article/details/5976207

MySQL 字段常用操作 添加,修改,删除,调整字段顺序

标签:

人气教程排行