BeginnerCoder

Lesson 18 — Mini project: report

Mini project: a monthly report

Combine what you know into one report: GROUP BY month, COUNT the orders, SUM the revenue, and compute the average order value = revenue / orders, rounded. SQLite's substr(text, start, length) cuts text: substr('2026-03-14', 1, 7) is '2026-03'.

SELECT substr(day, 1, 7) AS month, COUNT(*) FROM orders GROUP BY month

Why it matters: "orders, revenue and average basket per month" is the first report almost every online shop builds.

Want it another way?
Task

Fill in the avg_order column: revenue divided by the number of orders, rounded to 2 decimals. Expected: 3 months with orders, revenue and average.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with SQL Deep Dive

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.