gpt4 book ai didi

sql - oracle 11g 中的 USING 子句

转载 作者:行者123 更新时间:2023-12-02 04:41:20 24 4
gpt4 key购买 nike

 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 中的员工、部门、位置表。试试吧。

最佳答案

不,您不能将 ON 替换为 USING。但是您可以重写查询以在连接中包含 USING 子句。请参阅下面的正确语法:

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;

关于sql - oracle 11g 中的 USING 子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20790436/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com