AlgoMaster Logo

Exercise: Period-over-Period Comparisons

Last Updated: May 12, 2026

1 min read

For this exercise, we will work with below data:

SQL

Exercise 1

Easy

Write a query that returns the total number of streams per month for the entire platform. Show month (truncated to the first day) and stream_count. Order by month.

SQL

Expected Query

Expected Output

Exercise 2

Medium

Write a query that returns total platform revenue per month from the payments table, where revenue is amount - COALESCE(refund_amount, 0) for completed payments. Show month and revenue. Order by month.

SQL

Expected Query

Expected Output