PrepZone Logo
PrepZone
Back to Database

Database · Easy

Write a query to find the second highest salary.

DatabaseSQL QueriesFresherSubqueries

Answer preview

Rank the distinct salaries with DENSE_RANK() and keep rank 2 — this is the only version that stays correct when several employees share the top salary.…