Stepthrough Start free

SQL for business reports: monthly revenue, top customers and quiet accounts

Lesson cheat sheetOne page · US letterDB Fiddle

A free one-page SQL cheat sheet: SELECT, WHERE, SUM, GROUP BY, HAVING, ORDER BY, LIMIT and LEFT JOIN, with the three report queries from the course.

Free, no sign-up and no email needed. It prints on one letter-size page; the whole sheet is below.

▶StepthroughFree printable cheat sheet · learn.ynteractive.com

SQL for business reports: monthly revenue, top customers and quiet accounts

The three modules of the free SQL for Business Reports Jump Start, practised there on real DB Fiddle screens.

The building blocks

SELECT
SELECT * FROM orders; every column, every row.
WHERE
WHERE order_date >= '2026-09-01' keeps matching rows.
Totals
COUNT(*) counts rows, SUM(amount) adds a column, AS names it.
Sort
ORDER BY revenue DESC biggest first; LIMIT 3 keeps three rows.

Revenue by month

  1. SELECT DATE_FORMAT(order_date, '%Y-%m') AS month,
  2. SUM(amount) AS revenue FROM orders
  3. GROUP BY month ORDER BY month;

Key accounts ($3,000 or more)

  1. SELECT customer, COUNT(*) AS orders, SUM(amount) AS revenue
  2. FROM orders GROUP BY customer
  3. HAVING SUM(amount) >= 3000 ORDER BY revenue DESC;

Customers gone quiet

  1. SELECT c.name, c.manager, MAX(o.order_date) AS last_order
  2. FROM customers c LEFT JOIN orders o ON o.customer = c.name
  3. GROUP BY c.name, c.manager
  4. HAVING MAX(o.order_date) < '2026-09-01' OR MAX(o.order_date) IS NULL;

Good habits

  • Line order: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT.
  • WHERE filters rows; HAVING filters totals after GROUP BY.
  • "Who has not ..." questions need a LEFT JOIN and IS NULL.
  • Ask for a read-only login at work: reports only need SELECT.

Remember: Ask the database, not a pasted copy: the same query gives next month's report with no copying and no missed rows.

Practice it free: SQL: Build a Monthly Revenue Report from an Orders Table at learn.ynteractive.com/modules/sql-monthly-revenue-report. This sheet: learn.ynteractive.com/content/cheat-sheets/sql-business-reports. Lakeside Office Supply is a made-up business from the lesson. By Robert Breen, October 24, 2026.

Practice it in the free lesson

SQL: Build a Monthly Revenue Report from an Orders Table. A beginner SQL walkthrough in the free DB Fiddle: type a small orders table, then filter it, total it and turn it into revenue by month with GROUP BY, typing every line yourself. You do every step yourself in a practice copy of DB Fiddle, it checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, and nothing touches your real accounts.

Start the free lesson

Or read the full step-by-step guide

Lessons on this sheet

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

More cheat sheets

All free cheat sheets · All free tutorials