对表中数据进行查询
基础查询
查询多个字段
select 字段1,字段2 from 表名;
select * from 表名;
不显示重复记录
select distinct 字段 from 表名;
起别名
as
条件查询(where)
分组查询(group by)
select 字段列表 from where 分组前条件 group by 分组字段名 having 分组后条件过滤;
聚合函数
select 聚合函数(列名)from 表;
***null不参与运算
排序查询(order by)
select 字段列表 from 表名 order by 排序字段名1[排序方式1],排序字段名1[排序方式1];
asc 升序(默认值)
desc 降序
分页查询(limit)
select 字段列表 from 表名 limit 起始索引,查询条目数;
如有不足,请多指教,
未完待续,持续更新!
大家一起进步!