本文实例讲述了mysql修改表结构方法。分享给大家供大家参考。具体如下:
mysql修改表结构使用ALTER TABLE语句,下面就为您详细介绍mysql修改表结构的语句写法,希望对您学习mysql修改表结构方面能有所帮助。
- ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
- alter_specification:
- ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
- or ADD INDEX [index_name] (index_col_name,...)
- or ADD PRIMARY KEY (index_col_name,...)
- or ADD UNIQUE [index_name] (index_col_name,...)
- or ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
- or CHANGE [COLUMN] old_col_name create_definition
- or MODIFY [COLUMN] create_definition
- or DROP [COLUMN] col_name
- or DROP PRIMARY KEY
- or DROP INDEX index_name
- or RENAME [AS] new_tbl_name
- or table_options
新闻热点
疑难解答