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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值