tezvyn:

Calculate MRR with SQL including annual plans

Source: interviewintermediate

WHAT IT TESTS: correct MRR definition and date filtering. OUTLINE: sum monthly_price for subscriptions active this month, filter on start and end dates, and normalize annual plans by dividing annual price by 12.

WHAT IT TESTS: whether you can define MRR correctly and express it in SQL with proper active-window filtering. ANSWER OUTLINE: sum monthly_price across subscriptions whose start_date is on or before month end and whose end_date is null or on or after month start, so only currently active subs count. For annual plans, normalize: divide the annual amount by 12 so each month gets a twelfth, rather than booking a full year in one month. Use a CASE on plan_type.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Calculate MRR with SQL including annual plans · Tezvyn