SQL Functions   «Prev 

SQL Date functions - Quiz

Each question is worth one point. Select the best answer or answers for each question.
1. Assuming column names and table names are correct, what's wrong with the statement below? SELECT DATEDIFF(days, FirstDate, SecondDate), FirstDate, SecondDate FROM MyTable
Assuming column names and table names are correct, what is wrong with the statement below?
  A. "days" is not a valid time unit
  B. The table name is not indicated in the function parameters
  C. You cannot select additional columns after the function call
  D. Nothing is wrong with the statement

2. Which of the following will tell you the number of days that have elapsed since January 1, 1998?
Which of the following will tell you the number of days that have elapsed since January 1, 1998?
  A. SELECT DAYCOUNT(DAY, DATE '1998-01-01', SYSDATE)
  B. SELECT DATEDIFF(DAY, DATE '1998-01-01')
  C. SELECT DATEDIFF(WEEK, DATE '1998-01-01', SYSDATE) * 7
  D. SELECT DATEDIFF(DAY, DATE '1998-01-01', SYSDATE)

3. What does the following statement return? SELECT DATEADD(MONTH, -1, TIMESTAMP '2023-04-30 11:24:54 +01:00')
What does the following statement return?
  A. 2023-03-30 11:24:54 +01:00
  B. 2023-03-31 11:24:54 +01:00
  C. NULL, because March does not have 30 days in every year
  D. An error, because DATEADD does not accept negative values

4. Which of the following correctly returns the current date and time in Oracle?
Which of the following correctly returns the current date and time in Oracle?
  A. GETDATE()
  B. NOW()
  C. SYSDATE
  D. CURDATE()

5. Which of the following statements about DATEDIFF in Oracle is accurate?
Which of the following statements about DATEDIFF in Oracle is accurate?
  A. DATEDIFF has never been available in Oracle, and date differences still require manual subtraction
  B. DATEDIFF was introduced as a new function in Oracle AI Database 26ai specifically to ease migration from other database systems that already support it
  C. DATEDIFF only supports the YEAR and MONTH time units in Oracle
  D. DATEDIFF requires a separately licensed package to be installed before it can be used