oracle 11g中的USING子句 [英] USING clause in oracle 11g

查看:472
本文介绍了oracle 11g中的USING子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 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;

我们可以将"ON"子句替换为"USING"子句吗? oracle 11g中使用的Employees,Departments,Locations表. 试试吧.

Can we Replace 'ON' clause with 'USING' clause. -used Employees,Departments,Locations table in oracle 11g. Try It.

推荐答案

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

No you cannot just replace ON with USING. But you can rewrite the query to contain USING clause in joins. See correct syntax below:

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;

这篇关于oracle 11g中的USING子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆