🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 3
  2. B.SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 2
  3. C.SELECT DISTINCT salary FROM employees ORDER BY salary ASC LIMIT 1 OFFSET 3
  4. 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 →