给表添加列
alter table mso_customer
add `work_location` tinyint(3) DEFAULT NULL COMMENT '工作区域',
add `home_location` tinyint(3) DEFAULT NULL COMMENT '居住区域';
修改列
修改列时,如果只是修改部分属性,修改SQL也要包含已有的全部属性,否则会被重置为默认值
先通过命令查询列的全部属性
> show full columns from channel_manager_identity where field='name'\G
*************************** 1. row ***************************
Field: name
Type: varchar(100)
Collation: utf8mb4_general_ci
Null: YES
Key:
Default: NULL
Extra:
Privileges: select,insert,update,references
Comment: 身份标识名
1 row in set (0.00 sec)
修改列
> alter table channel_manager_identity modify `name` varchar(100) collate utf8mb4_general_ci comment '身份标识名';
Query OK, 0 rows affected (0.09 sec)
Records: 0 Duplicates: 0 Warnings: 0
修改后可以通过show命令查看结果。