Data Analyst

Case File: The League Table

Rankings, running totals and 'compared with last month' all need to look at other rows while keeping each row. In a real SQLite database in this page, build the league tables with window functions: the three best parcels in each city with ROW_NUMBER, a running total by month, the change from the previous month with LAG, the customers ranked with RANK (ties share a place), and the gap to the customer just above. The database is generated for you alone.

60 min

Case File: The League Table

Rankings, running totals and 'compared with last month' all need to look at other rows while keeping each row. In a real SQLite database in this page, build the league tables with window functions: the three best parcels in each city with ROW_NUMBER, a running total by month, the change from the previous month with LAG, the customers ranked with RANK (ties share a place), and the gap to the customer just above. The database is generated for you alone.

In this lesson:

  • sql
  • sqlite
  • window functions
  • rank
  • row_number
  • lag
  • running total
  • case-file

๐Ÿ”’ This lesson is part of a paid plan

This lesson is part of the Pro plan. Upgrade to unlock the full lesson, the labs and the exam.

Upgrade Now

This lesson is part of a paid plan

Upgrade to Pro to unlock this course, its labs and its exam.

View Pricing Plans