DENSE_RANK: top 2 days per platform by buyers, Feb 2025
Instructions
Consider purchases (purchases) made on or after February 1, 2025 and strictly before March 1, 2025; the platform of a purchase is the user's users.platform. For each platform and each calendar day (purchased_at::date) compute the metric buyers: the number of distinct buyers per day; days without purchases are not considered. Within a platform, rank the days by the metric descending using DENSE_RANK(): days with an equal metric get the same place, and the next place is not skipped. Output the days with place <= 2; because of ties there may be more than 2 of them on a platform. Columns: platform, purchase_date (the date), buyers, place. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
events.→user_id users.id - N:1Many-to-one
purchases.→user_id users.id
Table data
Select a table in the diagram or list to view its rows.