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 is wrong with the statement below?
SELECT DATEDIFF(days, FirstDate, SecondDate),
FirstDate, SecondDate
FROM MyTable
  A. "days" is not a valid interval
  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. Assuming GETDATE works with your engine, which of the following will tell you the number of days that have elapsed this year?
  A. SELECT DAYCOUNT(Day, 1/1/1998, getdate())
  B. SELECT DATEDIFF(Day, '1/1/1998')
  C. SELECT DATEDIFF(Weeks, '1/1/1998', GetDate()) * 7
  D. SELECT DATEDIFF (Day, '1/1/1998', GetDate())
Correct answers:

Your Score: 0