Analyzing Business Data in SQL
Learn to calculate profit, active users, retention, ARPU and percentiles in SQL, then turn the results into a readable executive report.
Calculating business KPIs in SQL is the subject here: profit, registrations, monthly active users, growth and retention rates, and average revenue per user. A single KPI cannot show how behavior varies across users, so the lessons also use histograms, bucketing and percentiles to reveal that spread. Every query runs against data from a fictional food delivery startup modeled on real companies, and the results are shaped into a report that managers and executives can read.
What You Will Achieve
- Calculate profit by combining separate revenue and cost queries in Common Table Expressions
- Track monthly active users and compute growth and retention rates with window functions
- Spot the variance in user behavior that a single average hides, using revenue buckets and percentiles
- Present finished KPIs as a pivoted monthly table that managers and executives can read quickly
Program Overview
Revenue, Cost, and Profit with CTEs
Revenue and cost queries are built on their own, then joined through Common Table Expressions to report profit for each eatery and month.
- Revenue per customer and per week
- Total cost and top meals by cost
- Common Table Expressions (CTEs)
- Profit per eatery and per month
User-Centric KPIs: Growth and Retention
Activity measures complement financial ones, with window functions turning monthly counts into running totals, growth rates and retention rates.
- Registrations and monthly active users (MAU)
- Window functions and running totals
- MAU monitors and order growth rate
- New, retained, and resurrected users
Unit Economics, Percentiles, and Executive Reports
Distributions of revenue and orders show the variance a single KPI hides, and the finished figures are pivoted and formatted into a report.
- Average revenue and orders per user
- Histograms and bucketing users
- Revenue quartiles and interquartile range
- Date formatting, ranking and pivoting
Certificate Awarded (Paid)
Job Outlook
These queries fit data analysis and business intelligence work, where revenue, user activity and retention figures are pulled from company data and packaged for managers and executives.
Good for: Analysts who want to compute business KPIs such as profit, retention and ARPU in SQL and turn them into a report for managers.
Keep in mind: Every exercise uses one fictional food delivery startup’s orders, users, meals and eateries, so the queries are written around that dataset’s tables.
Bottom line: A focused run through the KPI queries a food delivery business would track, ending with a pivoted, formatted report ready for executives.
Frequently Asked Questions
What business are the SQL queries written for?
All exercises draw on records from a fictional food delivery startup that is modeled on real companies. You query its orders, users, meals, eateries and costs to build each metric.
Which SQL techniques does the course rely on?
Common Table Expressions, window functions and joins carry most of the work. The closing lessons add a survey of useful functions, including date formatting, ranking users by order count and pivoting.
Why does the course cover histograms and percentiles?
A KPI is one number and cannot describe how data is distributed. Histograms, bucketing and percentiles show how revenue and orders vary between users, which helps spot differences in behavior.
What goes into the final executive report?
The report packages the KPIs built in the earlier lessons. You format dates, pivot user revenues and costs by month, and work on readability so managers and executives can use the figures.


There are no reviews yet.