SQL Date Functions - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
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 
  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
  The correct answer is A. "days" should be "day". The balance of the statement is correct.

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())
  The correct answer is D.
The correct statement indicates the interval and the start date, and the current date. While it may seem like the "Weeks" option would also work, remember that the DATEDIFF results are rounded.
With this in mind, the likelihood of the number of weeks being exactly correct is slim. It's better to use the "Day" interval option.