2020-12-20
阅读量:
608
sql修改表结构
1. Alter table 数据表名 rename 新表名;
2. Alter table 数据表名 modify 字段名 字段类型 约束条件(first、after);
3. Alter table 数据表名 change 原字段 新字段 字段类型 约束条件;
4. Alter table 数据表名 add 字段名 字段类型 约束条件(first、after );
5. Alter table 数据表名 drop 字段名;
6. Alter table 数据表名 add primary key(id);
7. Alter table 数据表名 drop primary key;
8. Alter table 数据表名 drop foreign key 名称;
9. Alter table 表名 add constraint 外键名 foreign key(字段名) references 主表(主键);






评论(0)


暂无数据