Question 115Asked in DSSSB TGT Computer Science, 7 Feb 2024, Shift 2 (12:30 PM)

Which of the following statement is correct for DATEDIFF function in SQL?

Which of the following statement is correct for DATEDIFF function in SQL? I. This function reports difference between the arguments ‘startdate’ and ‘enddate’. II. In this, ‘datepart’ argument/value can be specified in a variable.
  1. AOnly I
  2. BNeither I nor II
  3. CBoth I and II
  4. DOnly II
Show answerHide answer

Correct answer: (A) Only I

Explanation

DATEDIFF returns the difference between startdate and enddate in the given datepart, so I is correct. The datepart cannot be supplied through a user-defined variable or quoted string, so II is wrong.

From DSSSB TGT Computer Science PYQ, 7 Feb 2024, Shift 2 (12:30 PM)

This is question 115 of DSSSB TGT Computer Science PYQ, 7 Feb 2024, Shift 2 (12:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.