【2019年8月版本】OCP 071认证考试最新版本的考试原题-第8题

Choose the best answer

The EMPLOYEES table contains columns EMP_ID of data type NUMBER and HIRE_DATE of data type DATE

You want to display the date of the first Monday after the completion of six months since hiring

The NLS_TERRITORY parameter is set to AMERICA in the session and, therefore, Sunday is the first day ofthe week

Which query can be used?

A) SELECT emp_id,NEXT_DAY(ADD_MONTHS(hite_date,6), 'MONDAY') FROM employees;

B) SELECT emp_id,ADD_MONTHS(hire_date,6), NEXT_DAY('MONDAY') FROM employees;

C) SELECT emp_id,NEXT_DAY(MONTHS_BETWEEN(hire_date,SYSDATE),6) FROM employees;

D) SELECT emp_id,NEXT_DAY(ADD_MONTHS(hire_date,6),1) FROM employees;

Answer:A

(解析:本题 A 和 D 的答案非常相似,但是因为周日是第一天,所以 D 答案显示的是周日的日期。

在使用 next_day 的时候,要注意字符集,如果是中文的,就不能用 monday,而是用星期一:

SELECT NEXT_DAY(ADD_MONTHS(hiredate,6), '星期一') from emp2;

猜你喜欢

转载自blog.51cto.com/13854012/2443196