分页查询:
select * from t_student limit (currentPage -1) * pageSize,pageSize;
分组查询:
#一、分组函数
#聚合函数不是只能在分组中才能使用,而是分组了之后必须要使用这些函数才能保证数据完整性
#1、count()
select count(sal) from emp;
#2、avg()
select avg(sal) from emp;
#3、max()
select max(sal) from emp;
#4、min()
select min(sal) from emp;
#5、sum()
select sum(sal) from emp;
#6、DISTINCT
select distinct sal from emp;
#二、group by
#a、不带聚合函数
select DEPTNO from emp
group by DEPTNO;
#b、带聚合函数
select DEPTNO ,count(DEPTNO) from emp
group by DEPTNO;
#三、having的使用,having相当于分组中的where