表
- 修改表名(一):alter table 表名 rename [to | as] 新表名 修改表名(二):
- alter table 表名 to 新表名
字段
- 新增字段:alter table 表名 add 字段名称 字段类型 [约束条件] [after | first 字段名]
- [after | first 字段名 ] :位置
- 删除字段名:alter table 表名 drop [column] 字段名
- 修改类型(一):alter table 表名 modify 字段名 字段类型 [约束条件] [after | first 字段名]
- 修改类型(二):alter table 表名 change 原字段名 字段名 字段类型 [约束条件] [after | first 字段名]
- 添加主键:alter table 表名 add primary key(字段名)
- 删除主键:alter table 表名 drop primary key
- 添加唯一约束:alter table 表名 unique(字段名)
- 删除唯一约束:alter table 表名 drop index 索引
- 添加默认值:alter table 表名 alter 字段名称 set default ‘‘默认值’’
- 删除默认值:alter table 表名 alter 字段名称 drop default
- 修改自增长:alter table 表名 aotu_increment = 新开始
- 修改表名(一):alter table 表名 rename [to | as] 新表名
- 修改表名(二):alter table 表名 to 新表名
记录
1.新增记录(一): insert into 表名(字段名1,字段名2) values (值1 | default,值2)
2.新增记录(二):update 表名 字段名称 set 值