–group by
select deptno,count(*) from emp group by deptno;
–group by … having
select deptno, count(*) from emp group by deptno having count(*)>=5;
–join
select * from emp join dept on emp.deptno = dept.deptno;
–join right
select * from emp right join dept on emp.deptno = dept.deptno;