设为首页 加入收藏

TOP

ocp 1Z0-051 71-105题解析(二)
2014-11-24 00:37:21 来源: 作者: 【 】 浏览:64
Tags:ocp 1Z0-051 71-105 解析
-------

14

F选项,trim() 从字符串string的头,尾或两端截掉字符

75. The following dataexists in the PRODUCTS table:

PROD_ID PROD_LIST_PRICE

123456 152525.99

You issue the followingquery:

SQL> SELECT RPAD((ROUND(prod_list_price)), 10,'*')

FROM products

WHERE prod_id = 123456;

What would be theoutcome

A. 152526 ****

B. **152525.99

C. 152525** **

D. an error message

Answer: A

解析:
round(m,n)不指定n的值,直接取整数,为152525

Rpad(char1,n,char2)把字符串1右侧填充字符串char2使其长度达到n,如果字符串char1长度大于n,则返回字符串char1右侧n个字符

在这里,oracle有隐式转换,将数字转换为字符串

76. You need to displaythe first names of all customers from the CUSTOMERS table that contain the

character 'e' and havethe character 'a' in the second last position.

Which query would givethe required output

A. SELECTcust_first_name

FROM customers

WHEREINSTR(cust_first_name, 'e')<>0 AND

SUBSTR(cust_first_name,-2, 1)='a';

B. SELECTcust_first_name

FROM customers

WHEREINSTR(cust_first_name, 'e')<>'' AND

SUBSTR(cust_first_name,-2, 1)='a';

C. SELECTcust_first_name

FROM customers

WHEREINSTR(cust_first_name, 'e')IS NOT NULL AND

SUBSTR(cust_first_name,1,-2)='a';

D. SELECTcust_first_name

FROM customers

WHEREINSTR(cust_first_name, 'e')<>0 AND

SUBSTR(cust_first_name,LENGTH(cust_first_name),-2)='a';

Answer: A

解析:
INSTR(cust_first_name, 'e')<>0 返回e在cust_first_name的位置,这里等于0,表示为第一个位置

SUBSTR(cust_first_name,-2, 1)='a' 用于获取字串,-2表示位置,倒数第二个,1表示子串的长度

77. In the CUSTOMERStable, the CUST_CITY column contains the value 'Paris' for the

CUST_FIRST_NAME'ABIGAIL'.

eva luate the followingquery:

SQL> SELECT INITCAP(cust_first_name || ' ' ||

UPPER(SUBSTR(cust_city,-LENGTH(cust_city),2)))

FROM customers

WHERE cust_first_name ='ABIGAIL';

What would be theoutcome

A. Abigail PA

B. Abigail Pa

C. Abigail IS

D. an error message

Answer: B

解析:

Initcap 返回首字母大写

INITCAP (UPPER(SUBSTR(cust_city,-LENGTH(cust_city),2)))

INITCAP (UPPER(SUBSTR(cust_city,-5,2)))

INITCAP (UPPER(Pa))

INITCAP(PA)

Pa

78. eva luate thefollowing query:

SQL> SELECTTRUNC(ROUND(156.00,-1),-1)

FROM DUAL;

What would be theoutcome

A. 16

B. 100

C. 160

D. 200

E. 150

Answer: C

解析:

Round(m,n)对m进行四舍五入,n为负数,表示将m四舍五入到小数点左边第n位

Trunc(m,n)对m进行截取操作,n小于0时,表示截取到小数点左边第n位

TRUNC(ROUND(156.00,-1),-1)

TRUNC(160,-1)

160

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

In the CUSTOMERS table,the CUST_LAST_NAME column contains the values 'Anderson' and 'Ausson'.

You issue the followingquery:

SQL> SELECTLOWER(REPLACE(TRIM('son' FROM cust_last_name),'An','O'))

FROM CUSTOMERS

WHERELOWER(cust_last_name) LIKE 'a%n';

What would be theoutcome

\

A. 'Oder' and 'Aus'

B. a n error because theTRIM function specified is not valid

C. a n error because theLOWER function specified is not valid

D. a n error because theREPLACE function specified is not valid

Answer: B

解析:

scott@ORCL>selecttrim('son' from 'anderson') from dual;

select trim('son' from'anderson') from dual

*

第 1 行出现错误:

ORA-30001: 截取集仅能有一个字符

Trim的用法:

trim([leading | trailing| both] trim_char from string) 从字符串String中删除指定的字符trim_char。

leading:从字符串的头开始删除。

trailing:从字符串的尾部开始删除。

borth:从字符串的两边删除。

80. Which two statementsare true regarding working with dates (Choose two.)

A. The default internalstorage of dates is in the numeric format.

B. The default internalstorage of dates is in the character format.

C. The RR date formatautomatically calculates t

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

评论

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