数据库表操作

1. 数据表列修改

alter table Person add column IP bigint(16) default null comment '客户标识' after name; 在name后插入一列
alter table Person add column Address varchar(30) default null comment '来源编码'; 在最后插入一列

2. 索引操作

1.添加primary key(主键索引)
alter table 表名 add primary key(列名);

2.添加unique(唯一索引)
alter table 表名 add unique(列名);

3.添加index(普通索引)
alter table 表名 add index 索引名 (列名);

4.添加fulltext(全文索引)
alter table 表名 add fulltext (列名);

5.添加多列索引
alter table 表名 add index 索引名(index_name)  (列名1,列名2.......);

6.删除索引
DROP INDEX <索引名> ON <表名>;
ALTER TABLE <表名> DROP INDEX height;

  

posted @ 2022-08-08 16:16  不皮的皮卡丘  阅读(38)  评论(0)    收藏  举报