码迷,mamicode.com
首页 > 数据库 > 详细

【ocp-12c】最新Oracle OCP-071考试题库(39题)

时间:2019-02-26 16:53:37      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:each   exec   out   nvl   state   red   acl   view   sql   

39.choose the best answer

View the Exhibit and examine the description of the EMPLOYEES table.

 

You want to calculate the total remuneration for each employee. Total remuneration is the sum of the annual salary and the percentage commission earned for a year.

Only a few employees earn commission.

Which SQL statement would you execute to get the desired output?

A) SELECT first_name, salary, salary*12 + NVL(salary, 0)*commission_pct "Total"

FROM EMPLOYEES;

B) SELECT first_name, salary, salary*12+(salary*NVL2(commission_pct,

salary,salary+commission_pct)) "Total"

FROM EMPLOYEES;

C) SELECT first_name, salary, (salary + NVL(commission_pct,0)*salary)*12 "Total"

FROM EMPLOYEES;

D) SELECT first_name, salary, salary*12+salary*commission_pct "Total"

FROM EMPLOYEES;

Answer:A

(解析:题眼是“Only a few employees earn commission”,说明有人的佣金是 null,所以要用 nvl 函数)

【ocp-12c】最新Oracle OCP-071考试题库(39题)

标签:each   exec   out   nvl   state   red   acl   view   sql   

原文地址:https://www.cnblogs.com/cnblogs5359/p/10438295.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!