单行函数英文测试题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Review Questions
1. 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
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 calcu late week numbers with Oracle.
2. 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
3. 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.
4. Which single-row function could you use to return a specific portion of a character string?
A. INSTR
B. SUBSTR
C. LPAD
D. LEAST
5. The data in the PRODUCT table is as described here. The bonus amount is calculated as the lesser of 5 percent of the base price or 20 percent of the surcharge.
sku name division base_price surcharge
1001 PROD-1001 A 200 50
1002 PROD-1002 C 250
1003 PROD-1003 C 240 20
1004 PROD-1004 A 320
1005 PROD-1005 C 225 40
Which of the following statements will achieve the desired results?
A. SELECT sku, name, LEAST(base_price * 1.05, surcharge * 1.2) FROM products;
B. SELECT sku, name, LEAST(NVL(base_price,0) * 1.05, surcharge *
1.2) FROM products;
C. SELECT sku, name, COALESCE(LEAST(base_price*1.05, surcharge * 1.2), base_price * 1.05) FROM products;
D. A, B, and C will all achieve the desired results.
E. None of these statements will achieve the desired results.
6. Which function(s) accept arguments of any datatype? (Choose all that apply.)
A. SUBSTR
B. NVL
C. ROUND
D. DECODE
E. SIGN
7. What will be returned by SIGN(ABS(NVL(-32,0)))?
A. 1
B. 32
C. –1
D. 0
E. NULL