he century from the SYSDATE function and does not
allow the user to enterthe century.
D. The RR date formatautomatically calculates the century from the SYSDATE function but allows the
user to enter thecentury if required.
Answer: AD
解析:
Oracle内部存储的时间为数值格式
The RR datetime formatelement is similar to the YY datetime format element, but it
provides additionalflexibility for storing date values in other centuries. The RR
datetime format elementlets you store 20th century dates in the 21st century by
specifying only the lasttwo digits of the year.
81. You are currentlylocated in Singapore and have connected to a remote database in Chicago.
You issue the followingcommand:
SQL> SELECTROUND(SYSDATE-promo_begin_date,0)
FROM promotions
WHERE(SYSDATE-promo_begin_date)/365 > 2;
PROMOTIONS is the publicsynonym for the public database link for the PROMOTIONS table.
What is the outcome
A. a n error because theROUND function specified is invalid
B. a n error because theWHERE condition specified is invalid
C. n umber of days sincethe promo started based on the current Chicago date and time
D. number of days sincethe promo started based on the current Singapore date and time
Answer: C
解析:
当然是基于chicago的时间,因为sysdate也是获取chicago当前的时间
82. Examine the data inthe CUST_NAME column of the CUSTOMERS table.
CUST_NAME
Renske Ladwig
Jason Mallin
Samuel McCain
Allan MCEwen
Irene Mikkilineni
Julia Nayer
You need to displaycustomers' second names where the second name starts with "Mc" or"MC."
Which query gives therequired output
A. SELECTSUBSTR(cust_name, INSTR(cust_name,' ')+1)
FROM customers
WHEREINITCAP(SUBSTR(cust_name, INSTR(cust_name,' ')+1))='Mc';
B. SELECTSUBSTR(cust_name, INSTR(cust_name,' ')+1)
FROM customers
WHEREINITCAP(SUBSTR(cust_name, INSTR(cust_name,' ')+1)) LIKE 'Mc%';
C. SELECTSUBSTR(cust_name, INSTR(cust_name,' ')+1)
FROM customers
WHERE SUBSTR(cust_name,INSTR(cust_name,' ')+1) LIKE INITCAP('MC%');
D. SELECTSUBSTR(cust_name, INSTR(cust_name,' ')+1)
FROM customers
WHEREINITCAP(SUBSTR(cust_name, INSTR(cust_name,' ')+1)) = INITCAP('MC%');
Answer: B
解析:
INITCAP(SUBSTR(cust_name, INSTR(cust_name,' ')+1))
INSTR(cust_name,' ') 返回空字符串的位置
SUBSTR(cust_name,INSTR(cust_name,' ')+1)
截取空字符串后面的字符
INITCAP将每个单词的第一个字母大写,其他字母小写
83. Examine the data inthe CUST_NAME column of the CUSTOMERS table.
CUST_NAME
Lex De Haan
Renske Ladwig
Jose Manuel Urman
Jason Mallin
You want to extract onlythose customer names that have three names and display the * symbol in place
of the first name asfollows:
CUST NAME
*** De Haan
**** Manuel Urman
Which two queries givethe required output (Choose two.)
A. SELECTLPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name),'*') "CUSTNAME"
FROM customers
WHERE INSTR(cust_name, '',1,2)<>0;
B. SELECTLPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name),'*') "CUSTNAME"
FROM customers
WHERE INSTR(cust_name, '',-1,2)<>0;
C. SELECTLPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name)-
INSTR(cust_name,''),'*') "CUST NAME"
FROM customers
WHERE INSTR(cust_name, '',-1,-2)<>0;
D. SELECTLPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name)-
INSTR(cust_name,''),'*') "CUST NAME"
FROM customers
WHERE INSTR(cust_name, '',1,2)<>0 ;
Answer: AB
解析:
以Lex De Haan为例:
LPAD(SUBSTR(cust_name,INSTR(cust_name,'')),LENGTH(cust_name),'*')
,INSTR(cust_nam