Download your guide from here https://drive.google.com/file/d/1NnormoQ82utOFDpTc9Z7GGkQsJNNsC0z/view?usp=drive_link
Most people use ROW_NUMBER to find the 2nd highest salary in SQL.
Looks correct. Until there is a tie.
Two employees. Same salary.
ROW_NUMBER breaks the logic.
RANK fixes ties.
But it skips numbers.
Now SQL Nth Salary becomes unreliable.
DENSE_RANK is the answer.
Handles ties. No gaps.
Perfect for SQL Nth Salary problems.
Comment SQL to learn the right way.
Download your guide from here https://drive.google.com/file/d/1NnormoQ82utOFDpTc9Z7GGkQsJNNsC0z/view?usp=drive_link
Continue this lesson in the app
Install CourseHive on Android or iOS to keep learning while you move.