ITPub博客

首页 > 数据库 > Oracle > Oracle Certificate Profession 1Z0-051-07

Oracle Certificate Profession 1Z0-051-07

原创 Oracle 作者:LuiseDalian 时间:2014-05-08 07:47:10 0 删除 编辑
(7)Which two statements are true regarding the USING and ON clauses in table joins? (Choose two.)

A. Both USING and ON clauses can be used for equijoins and nonequijoins.

B. A maximum of one pair of columns can be joined between two tables using the ON clause.

C. The ON clause can be used to join tables on columns that have different names but compatible data types.

D. The WHERE clause can be used to apply additional conditions in SELECT statements containing the ON or the USING clause.

答案:(C、D)

解析:

--A(X), USING只能用于等值连接

--B(X), 可以指定多个pair of columns

select e.empno, e.ename, e.deptno, d.loc

from emp e join dept d

on(e.deptno = d.deptno and d.deptno = e.deptno)

where empno = 7788;

--D

--ON可以与WHERE一起使用

select e.empno, e.ename, e.deptno, d.deptno, d.loc

from emp e join dept d

on(e.deptno = d.deptno)

where e.empno = 7788;

     EMPNO ENAME       DEPTNO   DEPTNO LOC

---------- ---------- ---------- ---------- -------------

      7788 SCOTT                20           20  DALLAS

     

--USING可以和WHERE一起使用

select e.empno, e.ename, deptno, d.loc

from emp e join dept d

using(deptno)

where empno = 7788;

     EMPNO ENAME          DEPTNO LOC

---------- ---------- ---------- -------------

      7788 SCOTT              20 DALLAS

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17013648/viewspace-1156380/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-02-06

  • 博文量
    1986
  • 访问量
    6042351