Database problems · sql topics

6 SQL window function problems, solved step by step.

Problems that need each row to see its neighbours or its group: DENSE_RANK for top-N per group, LAG and LEAD for consecutive rows, and ROW_NUMBER for gaps and islands. Each one is solved in 6 SQL dialects and pandas, with queries you can run on the page.

0/6 solved
  1. Rank ScoresMedium
  2. Nth Highest SalaryMedium
  3. Consecutive NumbersMedium
  4. Exchange SeatsMedium
  5. Department Top Three SalariesHard
  6. Human Traffic of StadiumHard