修改约束
1、添加单列
alter table tb_name add [column] col_name column_definition [first|after col_name]
fist 添加到第一列
after col_name 添加到这一列的后面
2、删除列
alter table tb_name drop [column] col_name
3、添加主键约束
alter table tb_name add [constraint] primary key [index_type](index_col_name...);
4、添加唯一约束
alter table tb_name add [constraint] unique [index_type](index_col_name...);
5、添加外键约束
alter table tb_name add [constraint] foreign key [index_name](index_col_naem, ...) reference_definition;
6、添加/删除默认约束
alter table tb_name alter [column] col_name set default literal | drop default;
7、删除约束
alter table tb_name drop 约束名;
1、修改列定义
alter table tb_name modify [column] col_name column_definition [first | after col_name];
2、数据表更名
alter table tb_name rename [to|as] new_tb_name;
renaem table tb_name to new_tb_name [,tb_name2 to new_tb_name2]...;
插入记录 insert
1、
insert [into] tb_name [(col_name)] {values|value (expr...)};
2、
insert [into] tb_name set col_name={expr...};
更新记录 UPDATE
1、
update [low_priority] [ignore] table_reference set col_name={expr1|default} [, col_name2={...}]... [where condition]
删除记录 DELETE
delete from tb_name [where condition];
查找记录 SELECT
where 条件
group by 查询结果分组
order by 查询结果排序
LIMIT
limit 限制查询结果