// 增加
insert into 表名 values(值1,值2...)// 删除 (不会影响自增)
delete from 表名 (清空表记录)
// 清空表 (重新设置自增列,不会影响事务)
truncate 表名
//修改
update 表名 set 列1=值1... where ...
2、 DQL查询数据
// 查询
select ... from 表名
select * from 表名
// 别名
select ... as ... from
select distinct 列名 from 表名 返回唯一不同值
// 条件查询
select from where
区间查询 between and
// 模糊查询 // like 、%(0到任意字符)、_(一个字符)
select from where like'刘%'
select from where like ''
//in 具体值
select from where in [...]
select from where in('beijing','shanghai')// not null \null// and // or// 联表查询 join(leftjoin、rightjoin、innerjoin)on...// 子连接
分页和排序
// limit 和 order by
select...[distinct |*]
from 表名
[inner join...right join、left join]-- 联合查询
[on ...]-- 等值判断
[where...]-- 指定结果满足的条件
[group by]-- 分组
[having ]--过滤分组的记录
[order by]-- ASC 升序、desc降序
[limit 0,5]--
聚合函数
//COUNT
select count(*) from --不会忽略null
select count(1) from -- 不会忽略null列
select count(id) from --忽略所有null值
select AUM() from...
select MAX() from
select MIN() from
// 显示所有的索引信息
show index from database
// 增加索引 (索引名) 列名
alter table '表名' add fulltext index '索引名'(`字段名`,``...)// 创建索引
creat index 索引名 on 表名(字段)// 删除索引
drop index 索引名 on 表名
// 查询索引情况
explain...