ALTER COLUMN
ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
mysql> alter table film alter column rental_duration set default 5; mysql> alter table film alter column rental_duration drop default;
CHANGE COLUMN
语法:
CHANGE [COLUMN] old_col_name new_col_name column_definition [FIRST|AFTER col_name]
作用:
列的重命名、列类型的变更以及列位置的移动
例子:
ALTER TABLE MyTable CHANGE COLUMN foo bar VARCHAR(32) NOT NULL FIRST; ALTER TABLE MyTable CHANGE COLUMN foo bar VARCHAR(32) NOT NULL AFTER baz;
MODIFY COLUMN
语法:
MODIFY [COLUMN] col_name column_definition [FIRST | AFTER col_name]
作用: 除了列的重命名之外,他干的活和CHANGE COLUMN是一样的 例子:
ALTER TABLE MyTable MODIFY COLUMN foo VARCHAR(32) NOT NULL AFTER baz;
摘自:http://blog.itpub.net/26515977/viewspace-1208252/