Q&A
Q&AHow do you find the third-highest distinct salary in SQL?
Use DENSE_RANK for distinct values and state whether you want salary values or employee rows.
Read the concise answer
Filter out NULL salaries, compute DENSE_RANK() OVER (ORDER BY salary DESC), then select rank 3. DENSE_RANK treats equal salaries as the same rank. PostgreSQL, MySQL 8+, and Oracle support this window-function approach; if you instead mean the third row, use ROW_NUMBER with a deterministic tie-breaker.