时间:2021-07-01 10:21:17 帮助过:3人阅读
9,删除主键约束:alter table table_name drop primary key;
10,添加唯一约束:alter table table_name unique(column_name1,column_name2..);
11,删除唯一约束:
a,查询index:show index from table_name;
b,alter table table_name drop index Key_name;
12,添加外键约束:alter table child_table add [constraint FK_tablename_column] foreing key (fid) references father_table (id);
*13,删除外键约束:
a,查看外键约束名称:show create table table_name;
b,删除外键约束:alter table table_name drop foreing key constraint;
14,添加默认约束:alter table table_name alter column set default value;
15,删除默认约束:alter table table_name alter column drop default;
16,修改列定义和位置:alter table table_name modify column_name varchar(50) after column_name;
/*********以下两种慎用**************************************************************************************/
17,修改列名称和定义:alter table table_name change column_name1 column_name2 varchar(100);
18,修改表名称:alter table table_name rename table_name1;
mysql数据表操作&库操作
标签: