设为首页 加入收藏

TOP

ocp 1Z0-051 71-105题解析(六)
2014-11-24 00:37:21 来源: 作者: 【 】 浏览:67
Tags:ocp 1Z0-051 71-105 解析
, TO_DATE('JUL 01 98'));

Answer: AB

A选项,测试:

sys@ORCL>select TO_CHAR(sysdate,'yyyy') from dual;

TO_C

----

2013

B选项,测试:

sys@ORCL>selectTO_CHAR(sysdate,'mon dd yy') from dual;

TO_CHAR(SYSDAT

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

12月 03 13

C选项,to_date()中的不符合日期格式

D选项,to_date()中的不符合日期格式

92. View the E xhibitand examine the data in the PROMO_NAME and PROMO_END_DATE columns of

the PROMOTIONS table,and the required output format.

Which two queries givethe correct result (Choose two.)

\

A. SELECT promo_name,TO_CHAR(promo_end_date,'Day') ', '

TO_CHAR(promo_end_date,'Month')' '

TO_CHAR(promo_end_date,'DD,YYYY') AS last_day

FROM promotions;

B. SELECTpromo_name,TO_CHAR (promo_end_date,'fxDay') ', '

TO_CHAR(promo_end_date,'fxMonth')' '

TO_CHAR(promo_end_date,'fxDD,YYYY') AS last_day

FROM promotions;

C. SELECT promo_name,TRIM(TO_CHAR(promo_end_date,'Day')) ', '

TRIM(TO_CHAR(promo_end_date,'Month'))' '

TRIM(TO_CHAR(promo_end_date,'DD,YYYY')) AS last_day

FROM promotions;

D.SELECTpromo_name,TO_CHAR(promo_end_date,'fmDay')','

TO_CHAR(promo_end_date,'fmMonth')' '

TO_CHAR(promo_end_date,'fmDD,YYYY') AS last_day

FROM promotions;

Answer: CD

解析:

TRIM(TO_CHAR(promo_end_date,'Day'))

TO_CHAR(promo_end_date,'fmDay')

TO_CHAR(promo_end_date,'fxDay')

得到星期几

TRIM(TO_CHAR(promo_end_date,'Month'))

TO_CHAR(promo_end_date,'fmMonth')

TO_CHAR(promo_end_date,'fxMonth')

得到几月

TRIM(TO_CHAR(promo_end_date,'DD,YYYY'))

TO_CHAR(promo_end_date,'fmDD,YYYY')

TO_CHAR(promo_end_date,'fxDD,YYYY')

得到 几号,年份

93. View the Exhibit andexamine the structure of the CUSTOMERS table.

Using the CUSTOMERStable, y ou need to generate a report that shows an increase in the creditlimit

by 15% for allcustomers. Customers whose credit limit has not been entered should have themessage "

Not Available"displayed.

Which SQL statementwould produce the required result

\

A. SELECTNVL(cust_credit_limit,'Not Available')*.15 "NEW CREDIT"

FROM customers;

B. SELECTNVL(cust_credit_limit*.15,'Not Available') "NEW CREDIT"

FROM customers;

C. SELECTTO_CHAR(NVL(cust_credit_limit*.15,'Not Available')) "NEW CREDIT"

FROM customers;

D. SELECT NVL(TO_CHAR(cust_credit_limit*.15),'NotAvailable') "NEW CREDIT"

FROM customers;

Answer: D

解析:

需要处理空值,Nvl 如果为空值,就返回后面的字符串

TO_CHAR(cust_credit_limit*.15)先计算,如果cust_credit_limit为空,最终结果还是为空,所以返回 Not Availiable

94. Examine thestructure of the PROGRAMS table:

name Null Type

PROG_ID NOT NULLNUMBER(3)

PROG_COST NUMBER(8,2)

START_DATE NOT NULL DATE

END_DATE DATE

Which two SQL statementswould execute successfully (Choose two.)

A. SELECT NVL(ADD_MONTHS(END_DATE,1),SYSDATE)

FROM programs;

B. SELECTTO_DATE(NVL(SYSDATE-END_DATE,SYSDATE))

FROM programs;

C. SELECTNVL(MONTHS_BETWEEN(start_date,end_date),'Ongoing')

FROM programs;

D. SELECTNVL(TO_CHAR(MONTHS_BETWEEN(start_date,end_date)),'Ongoing')

FROM programs;

Answer: AD

解析:

B选项,SYSDATE-END_DATE运算结果不能作为正确的日期格式

C选项,无法返回 'Ongoing'

引用官方文档:

The arguments expr1 andexpr2 can have any data type. If their data types are

different, then OracleDatabase implicitly converts one to the other. If they cannot be

converted implicitly,then the database returns an error

95. The PRODUCTS tablehas the following structure:

name Null Type

PROD_ID NOT NULLNUMBER(4)

PROD_NAME VARCHAR2(25)

PROD_EXPIRY_DATE DATE

ev

首页 上一页 3 4 5 6 7 8 9 下一页 尾页 6/10/10
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇UNION和UNION ALL两者之间在性能.. 下一篇在Contos下安装tomcat6.0.29

评论

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