select e.employee_id,e.last_name,e.department_id,
d.department_name,l.city,l.location_id
from employees e
join departments d
on e.department_id=d.department_id
join locations l
on l.location_id=d.location_id
and e.manager_id=149;
我们可以用“ USING”子句替换“ ON”子句吗?oracle 11g中使用的Employees,Departments,Locations表。试试吧。
不,您不能只替换ON
为USING
。但是您可以将查询重写为包含USING
joins中的子句。请参见下面的正确语法:
select e.employee_id,
e.last_name,
department_id, --Note there is no table prefix
d.department_name,
l.city,
location_id --Note there is no table prefix
from employees e
join departments d
using (department_id)
join locations l
using (location_id)
where e.manager_id = 149;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句