客趣旅游网
增加列
基本语句为(圆括号为必要项,方括号为选择项):
(推荐教程:)
alter table (table_name) add (column_name) (col_type) [default|auto_increment|…]
举例:
#table_name=province, column_name=area, col_type=int ALTER TABLE province ADD area INT; #同时添加个字段 ALTER TABLE province ADD ( area INT, population int );
删除列(字段)
基本语句:
alter table (table_name) drop COLUMN (column_name)
例子:
ALTER TABLE province DROP COLUMN area #删除多个字段 ALTER TABLE province DROP COLUMN area, DROP COLUMN population