cnblogs5359

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;

分类:

技术点:

相关文章:

  • 2021-09-18
  • 2021-09-18
  • 2021-09-18
  • 2021-09-18
  • 2021-09-18
  • 2022-12-23
  • 2022-01-07
  • 2021-09-18
猜你喜欢
  • 2022-01-07
  • 2021-10-24
  • 2021-09-18
  • 2021-09-18
  • 2022-01-07
  • 2021-09-15
  • 2021-09-18
相关资源
相似解决方案