About the “Month-over-Month Revenue Growth with LAG()” SQL Problem
Business Scenario
Finance and executive leadership evaluate SaaS health based on Month-over-Month (MoM) revenue acceleration. Using SQL window functions allows calculating historical velocity without costly self-joins.
Expected Output & Criteria
Time-series table showing month_date, revenue, prev_month_revenue, and growth_pct.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE monthly_revenue (
month_date DATE PRIMARY KEY,
revenue NUMERIC(12, 2) NOT NULL
);Target SQL Clauses & Operators
LAGOVERORDER BY
Want more Window Functions practice?
Explore the full syllabus of 14 exercises, syntax guides, and interview pitfalls.