追加: alter table table-name add column dataName datatype
修改数据类型: alter table table-name modify column dataName datatype-other
修改列名: alter table table-name change column dataName dataName-other datatype
删除列: alter table table-name drop column dataName
}
1.添加PRIMARY KEY(主键索引)mysql>ALTER TABLE `table_name` ADD PRIMARY KEY (
`column` )
2.添加UNIQUE(唯一索引)
mysql>ALTER TABLE `table_name` ADD UNIQUE
(
`column`
)
3.添加INDEX(普通索引)
mysql>ALTER TABLE `table_name`
ADD INDEX index_name ( `column` )
4.添加FULLTEXT(全文索引)
mysql>ALTER
TABLE `table_name` ADD FULLTEXT ( `column`)
5.添加多列索引
mysql>ALTER
TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)