• 【OCP12c】CUUG最新考试原题整理及答案(07110)


    10、(5-6) choose the best answer:
    Examine the structure of the EMPLOYEES table:
    There is a parent/child relationship between EMPLOYEE_ID and MANAGER_ID.
    You want to display the name, joining date, and manager for all the employees.
    Newly hired employees are yet to be assigned a department or a manager. For them, 'No Manager' should be displayed in the MANAGER column.

    Which SQL query gets the required output?
    A) SELECT e.last_name, e.hire_date, NVL(m.last_name, 'No Manager') Manager
    FROM employees e RIGHT OUTER JOIN employees m
    ON (e. manager_id = m.employee_id);

    B) SELECT e.last_name, e.hire_date, NVL(m.last_name, 'No Manager') Manager
    FROM employees e JOIN employees m
    ON (e.manager_id = m.employee_id);

    C) SELECT e.last_name, e.hire_date, NVL(m.last_name, 'No Manager') Manager
    FROM employees e LEFT OUTER JOIN employees m
    ON (e.manager_id = m.employee_id);

    D) SELECT e.last_name, e.hire_date, NVL(m.last_name, 'No Manager') Manager
    FROM employees e NATURAL JOIN employees m
    ON (e.manager_id = m.employee_id);

    Answer:C
    (解析:因为员工 king 是没有经理的,但是也要显示出来,因为是在经理号这边缺少数据,所以这里要用
    左外连接。注意左右的区别:
    SELECT e.last_name, e.hire_date, NVL(m.last_name, 'No Manager') Manager
    FROM employees e , employees m
    WHERE e.manager_id = m.employee_id(+);

  • 相关阅读:
    图灵2010.05书讯
    上海.NET技术交流会
    图灵2010.07书讯
    高效模式编写者的7个习惯
    QRCode 二维码开源DLL
    javascript 复习
    关于反射技术
    数字签名与加密解密
    使用负载均衡技术建设高负载的网络站点
    dreamweaver cs5.5中的phonegap升级测试
  • 原文地址:https://www.cnblogs.com/cnblogs5359/p/10382803.html
Copyright © 2020-2023  润新知