← Quiz: SQL Interview Queries: all 10 questions
Quiz: SQL Interview Queries · Question 10 of 10
Why is joined = '2022-01-01' AND joined < '2024-01-01' preferred over YEAR(joined) IN (2022, 2023)?
Why is joined >= '2022-01-01' AND joined < '2024-01-01' preferred over YEAR(joined) IN (2022, 2023)?
- A.It returns different rows
- B.The bare column can use an index on joined; a function on the column usually cannot
- C.YEAR() does not exist in any database
- D.Dates cannot be compared with >=
Answer & explanation
Correct answer: The bare column can use an index on joined; a function on the column usually cannot
Keeping the indexed column untouched keeps the query index-friendly.
Can you get the rest right without peeking?
Take the timed Quiz: SQL Interview Queries quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →