设为首页 加入收藏

TOP

ocp 1Z0-051 1-22题解析(六)
2014-11-23 22:31:36 来源: 作者: 【 】 浏览:11
Tags:ocp 1Z0-051 1-22 解析
显错误,别名是不能用来作为表达式的

16. eva luate thefollowing query:

SQL> SELECTpromo_name || q'{'s start date was }' ||promo_begin_date

AS "PromotionLaunches"

FROM promotions;

What would be theoutcome of the above query

A. It produces an errorbecause flower braces have been used.

B. It produces an errorbecause the data types are not matching.

C. It executessuccessfully and introduces an 's at the end of each promo_name in the output.

D. It executessuccessfully and displays the literal " {'s start date was } " foreach row in the output.

Answer: C

解析:

scott@ORCL>SELECTename || q'{'s start date was }' || hiredate

2 AS"Promotion Launches"

3 fromemp;

Promotion Launches

------------------------------------------

SMITH's start date was17-12月-80

ALLEN's start date was20-2月 -81

WARD's start date was22-2月 -81

JONES's start date was02-4月 -81

MARTIN's start date was28-9月 -81

BLAKE's start date was01-5月 -81

CLARK's start date was09-6月 -81

SCOTT's start date was19-4月 -87

KING's start date was17-11月-81

TURNER's start date was08-9月 -81

ADAMS's start date was23-5月 -87

JAMES's start date was03-12月-81

FORD's start date was03-12月-81

MILLER's start date was23-1月 -82

17. View the E xhibitand examine the data in the EMPLOYEES table.

You want to generate areport showing the total compensation paid to each employee to date.

You issue the followingquery:

SQL>SELECT ename|| ' joined on ' || hiredate ||

', the totalcompensation paid is ' ||

TO_CHAR(ROUND(ROUND(SYSDATE-hiredate)/365)* sal + comm)

"COMPENSATION UNTILDATE"

FROM emp;

What is the outcome

\

A. It generates an errorbecause the alias is not valid.

B. It executessuccessfully and gives the correct output.

C. It executessuccessfully but does not give the correct output.

D. It generates an errorbecause the usage of the ROUND function in the expression is not valid.

E. It generates an errorbecause the concatenation operator can be used to combine only two items.

Answer: C

解析:能正确执行,但是不能得到正确的结果

scott@ORCL>

scott@ORCL>SELECTename || ' joined on ' || hiredate ||

2 ',the total compensation paid is ' ||

3 TO_CHAR(ROUND(ROUND(SYSDATE-hiredate)/365) * sal + comm)

4 "COMPENSATION UNTIL DATE"

5 FROMemp;

COMPENSATION UNTIL DATE

--------------------------------------------------------------------

SMITH joined on 17-12月-80, the total compensation paid is

ALLEN joined on 20-2月 -81, the total compensation paid is 52960

WARD joined on 22-2月 -81, the total compensation paid is 41750

JONES joined on 02-4月 -81, the total compensation paid is

MARTIN joined on 28-9月 -81, the total compensation paid is 41400

BLAKE joined on 01-5月 -81, the total compensation paid is

CLARK joined on 09-6月 -81, the total compensation paid is

SCOTT joined on 19-4月 -87, the total compensation paid is

KING joined on 17-11月-81, the total compensation paid is

TURNER joined on 08-9月 -81, the total compensation paid is 48000

ADAMS joined on 23-5月 -87, the total compensation paid is

JAMES joined on 03-12月-81, the total compensation paid is

FORD joined on 03-12月-81, the total compensation paid is

MILLER joined on 23-1月 -82, the total compensation paid is

已选择14行。

发现奖金为空的,最后得不到结果

scott@ORCL>select1000+comm from emp where empno=7369;

1000+COMM

在oracle中如果如果不出来空值,任何数相加都会得到空值

scott@ORCL>select1000+nvl(comm,0) from emp where empno=7369;

1000+NVL(COMM,0)

----------------

1000

18. Examine thestructure of the PROMOTIONS table:

name Null Type

PROMO_ID NOT NULLNUMBER(6)

PROMO

首页 上一页 3 4 5 6 7 8 下一页 尾页 6/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇pg_cancel_backend() 与pg_termin.. 下一篇MongoDB 复制集 (三) 内部数据同步

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: