AlgoMaster Logo

Exercise: Funnel Analysis, Cohorts, and Retention

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 count of users in each subscription plan, ordered from the most populated plan to the least. Show plan and user_count. Count distinct user_ids per plan.

SQL

Expected Query

Expected Output

Exercise 2

Medium

Write a query that returns each user's signup month and the number of users in that monthly cohort. Show cohort_month (DATE_TRUNC of signup_date) and cohort_size. Order by cohort_month.

SQL

Expected Query

Expected Output