where 条件筛选
select * from student_user where age>20;
select * from student_user where age>20 and class=172;
select * from student_user where brithday>'2019-03-28';
like 模糊查询
% 通配全字符,0或多个
_ 通配一个字符
select * from student_user where name like '%a';
select * from student_user where name like '%a%';
select * from student_user where name like 'z%';
order by 排序
select * from student_user order by age asc;
select * from student_user order by age desc;
聚合函数,组函数
count 统计
select count(*) from student_user;
select count(1) from student_user;
max 最大值
select id, name, max(price) from student_user;
min 最小值
select id,name,min(price) from student_user;
sum 总和
select sum(price) from student_user;
avg 平均
select avg(price) from student_user;
limit 分页查询
select * from student_user limit m,n;
m表示:大于n,从n+1开始
n表示:偏移量,查几条