← Quiz: SQL Interview Queries: all 10 questions
Quiz: SQL Interview Queries · Question 6 of 10
Which query gives the 3rd highest distinct salary using LIMIT and OFFSET?
Which query gives the 3rd highest distinct salary using LIMIT and OFFSET?
- A.SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 3
- B.SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 2
- C.SELECT DISTINCT salary FROM employees ORDER BY salary ASC LIMIT 1 OFFSET 3
- D.SELECT salary FROM employees LIMIT 3 OFFSET 1
Answer & explanation
Correct answer: SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 2
Skip the top 2 distinct values (OFFSET N−1) and take one.
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 →