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

    17. View the E xhibit and examine the data in the EMPLOYEES table.
    You want to generate a report showing the total compensation paid to each employee to  date.
    You issue the following query:
    SQL>SELECT ename ' joined on ' hiredate     
    ', the total compensation paid is '    
    TO_CHAR(ROUND(ROUND(SYSDATE-hiredate)/365) * sal + comm)    
    "COMPENSATION UNTIL DATE"    
    FROM employees;

    sys@TESTDB> select * from scott.emp;
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30


     


    What is the outcome?

    A. It generates an error because the alias is not valid.
    B. It executes successfully and gives the correct output.
    C. It executes successfully but does not give the correct output.
    D. It generates an error because the usage of the  ROUND function in the expression is not valid.
    E. It generates an error because the concatenation operator can be used to combine only two items.

    sys@TESTDB> select TO_CHAR(ROUND(ROUND(SYSDATE-hiredate)/365) * sal + comm) "COMPENSATION UNTIL DATE"
      2  from scott.emp;
    
    COMPENSATION UNTIL DATE
    ----------------------------------------
    
    53100
    41750
    
    41400
    
    
    
    
    48000
    
    
    
    
    
    14 rows selected.


    因为comm有null值,故任何数值与nll相加为null,故出错。

    此题答案选C

  • 相关阅读:
    Sql server Always On 读写分离配置方法
    MSSQL AlwaysOn中的“主角色中的连接”和“可读辅助副本”
    Windows Server 2019 Active Directory (AD域)时间不同步的解决方法
    windows server 2008 R2 域中用组策略隐藏指定磁盘驱动器(盘符)
    pg数据库优化
    Qlik
    如何查看数据库特别慢
    针对数量的null值最好要做变0处理
    pg如何实现月份的加减
    sql
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317261.html
Copyright © 2011-2022 走看看