zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-V9.02-127题

    127. Examine the data in the CUSTOMERS table:

    CUSTNO    CUSTNAME    CITY

    1         KING        SEATTLE

    2         GREEN       BOSTON

    3         KOCHAR      SEATTLE

    4         SMITH       NEW YORK

    You want to list all cities that have more than one customer along with the customer details. 

    Evaluate the following query:

    SQL>SELECT c1.custname, c1.city

    FROM Customers c1 __________________ Customers c2

    ON (c1.city=c2.city AND c1.custname<>c2.custname);

    Which two JOIN options can be used in the blank in the above query to give the correct output? (Choose

    two.)

    A. JOIN

    B. NATURAL JOIN  

    C. LEFT OUTER JOIN   

    D. FULL OUTER JOIN  

    E. RIGHT OUTER JOIN

    Answer: AE
     答案解析:


    scott@TESTDB> SELECT * FROM CUSTOMERS;
     
        CUSTNO CUSTNAME   CITY
    ---------- ---------- ----------
             1 KING       SEATTLE
             2 GREEN      BOSTON
             3 KOCHAR     SEATTLE
             4 SMITH      NEW YORK

    你想要列出所有的城市,有一个以上的客户以及客户的细节
    A
    scott@TESTDB>  select c1.custname,c1.city from customers c1 join customers c2
      2  on (c1.city=c2.city and c1.custname<>c2.custname);
     
    CUSTNAME   CITY
    ---------- ----------
    KOCHAR     SEATTLE
    KING       SEATTLE

    B,select列表中c1.city有限定
    scott@TESTDB>  select c1.custname,c1.city from customers c1 natural join customers c2
      2  on (c1.city=c2.city and c1.custname<>c2.custname);
    on (c1.city=c2.city and c1.custname<>c2.custname)
    *
    ERROR at line 2:
    ORA-00933: SQL command not properly ended
     
     
     C
    scott@TESTDB>  select c1.custname,c1.city from customers c1 left outer join customers c2
      2  on (c1.city=c2.city and c1.custname<>c2.custname);
     
    CUSTNAME   CITY
    ---------- ----------
    KOCHAR     SEATTLE
    KING       SEATTLE
    SMITH      NEW YORK
    GREEN      BOSTON
     D

    scott@TESTDB>  select c1.custname,c1.city from customers c1 full outer join customers c2
      2  on (c1.city=c2.city and c1.custname<>c2.custname);
     
    CUSTNAME   CITY
    ---------- ----------
    KOCHAR     SEATTLE
    KING       SEATTLE
    SMITH      NEW YORK
    GREEN      BOSTON

    E
     scott@TESTDB>  select c1.custname,c1.city from customers c1 right outer join customers c2
      2  on (c1.city=c2.city and c1.custname<>c2.custname);
     
    CUSTNAME   CITY
    ---------- ----------
    KING       SEATTLE
    KOCHAR     SEATTLE
     

     
     
  • 相关阅读:
    16日彻底去除安卓应用的内置广告
    配台600元的主机套装 自己组装 全新
    带记录功能的计算器
    华为8812 进入工程模式 和打电话黑屏问题
    买平板 四核 500~600左右对比
    querySelector()方法
    Javascript实例教程:querySelector()方法接受一个CSS查询并返回匹配模式的第一个子孙元素,如果没有匹配的元素则返回null。
    Android实用代码七段(二)
    Android实用代码七段(三)
    Firebug入门指南
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316864.html
Copyright © 2011-2022 走看看