11.
You want to display each project's start date as the day, week, number, and year. Which
statement will give output like the following?
Tuesday Week 23, 2008
Tuesday Week 23, 2008
- [A]SELECT proj_id, TO_CHAR(start_date, 'DOW Week WOY YYYY') FROM projects;
- [B]SELECT proj_id, TO_CHAR(start_date,'Day'||' Week'||' WOY, YYYY') FROM projects;
- [C]SELECT proj_id, TO_CHAR(start_date, 'Day" Week" WW, YYYY') FROM projects;
- [D]SELECT proj_id, TO_CHAR(start_date, 'Day Week# , YYYY') FROM projects;
- [E]You can't calculate week numbers with Oracle.
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
Double quotation marks must surround literal strings like "Week". |
12.
What will the following statement return?
SELECT last_name, first_name, start_date FROM employees WHERE hire_date < TRUNC(SYSDATE) – 5;
- [A]Employees hired within the past five hours
- [B]Employees hired within the past five days
- [C]Employees hired more than five hours ago
- [D]Employees hired more than five days ago
- Answer & Explanation
- Report
Answer : [D]
Explanation :
Explanation :
The TRUNC function removes the time portion of a date by default, and whole numbers added to or subtracted from dates represent days added or subtracted from that date. TRUNC(SYSDATE) –5 means five days ago at midnight. |
13.
Which assertion about the following statements is most true?
SELECT name, region_code||phone_number FROM customers; SELECT name, CONCAT(region_code,phone_number) FROM customers;
- [A]If REGION_CODE is NULL, the first statement will not include that customer's PHONE_ NUMBER.
- [B]If REGION_CODE is NULL, the second statement will not include that customer's PHONE_ NUMBER.
- [C]Both statements will return the same data.
- [D]The second statement will raise an error if REGION_CODE is NULL for any customer.
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
The two statements are equivalent. |
14.
Which single-row function could you use to return a specific portion of a character string?
- [A]INSTR
- [B]SUBSTR
- [C]LPAD
- [D]LEAST
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
SUBSTR returns part of the string. INSTR returns a number. LPAD adds to a character string. LEAST does not change an input string. |
15.
Which function(s) accept arguments of any datatype? (Choose all that apply.)
- [A]SUBSTR
- [B]NVL
- [C]ROUND
- [D]DECODE
- [E]SIGN
- Answer & Explanation
- Report
Answer : [B,D]
Explanation :
Explanation :
ROUND does not accept character arguments. SUBSTR accepts only character arguments. SIGN accepts only numeric arguments. |