【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;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章