三张表,四张表怎么连接?
语法:
select
...
from
a
join
b
on
a和b酌连按条件
join
on
a和c的连按条件
join
d
a和d的连接条件
案例:找出每个员工的部门名称以及工资等级,要求显示员工名、部门名、薪资、薪资等级?
select
e. ename ,e. sal,d. dname, s . grade
from
emp e
join
dept d
on
e. deptno = d. deptno
join
salgrade s
on
e.sal between s . losal and s.hisal ;