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

> 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.

Source: https://learn.ynteractive.com/content/cheat-sheets/sql-business-reports · Updated 2026-10-24 · Free from Stepthrough (https://learn.ynteractive.com)

[Lesson cheat sheet](https://learn.ynteractive.com/content/cheat-sheets#kind-lesson) · One page · US letter · [DB Fiddle](https://learn.ynteractive.com/content/tool/db-fiddle)

By [Robert Breen](https://learn.ynteractive.com/content/about) · Published October 24, 2026 · From the free lesson [SQL: Build a Monthly Revenue Report from an Orders Table](https://learn.ynteractive.com/content/sql-monthly-revenue-report)

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.

[Download the free PDF (83 KB)](https://learn.ynteractive.com/content/cheat-sheets/sql-business-reports.pdf)Print this sheet

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](https://learn.ynteractive.com/modules/sql-monthly-revenue-report) 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](https://learn.ynteractive.com/modules/sql-monthly-revenue-report)

[Or read the full step-by-step guide](https://learn.ynteractive.com/content/sql-monthly-revenue-report)

## Lessons on this sheet

- [SQL: Build a Monthly Revenue Report from an Orders Table](https://learn.ynteractive.com/content/sql-monthly-revenue-report): 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…
- [SQL: Top Customers and Key Accounts with GROUP BY and HAVING](https://learn.ynteractive.com/content/sql-top-customers): A beginner SQL walkthrough in the free DB Fiddle: total revenue per customer with GROUP BY, sort the biggest to the top, keep the top three with LIMIT and list key…
- [SQL: Find Customers Who Have Gone Quiet with a LEFT JOIN](https://learn.ynteractive.com/content/sql-quiet-customers): A beginner SQL walkthrough in the free DB Fiddle: join a customers table to orders, see why a plain JOIN hides customers who never ordered, and list every quiet account…

## Related terms

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

[SQL](https://learn.ynteractive.com/content/glossary/sql) · [GROUP BY (SQL)](https://learn.ynteractive.com/content/glossary/group-by) · [LEFT JOIN (SQL)](https://learn.ynteractive.com/content/glossary/left-join)

[The full AI glossary](https://learn.ynteractive.com/content/glossary)

## More cheat sheets

- [AI Email Responder in n8n Cheat Sheet](https://learn.ynteractive.com/content/cheat-sheets/ai-email-responder-n8n): A free one-page cheat sheet: n8n watches Gmail, an AI agent reads each customer email and saves a reply as a draft in the same thread.
- [AI Receipt Extractor in n8n Cheat Sheet](https://learn.ynteractive.com/content/cheat-sheets/receipt-extraction-setup): A free one-page cheat sheet: attach a receipt photo in n8n chat, and an AI agent pulls the date, vendor and amount into a Google Sheets row.
- [ChatGPT Bank Reconciliation Cheat Sheet](https://learn.ynteractive.com/content/cheat-sheets/chatgpt-bank-reconciliation): A free one-page cheat sheet: match a bank statement CSV to the ledger with ChatGPT, list the exceptions, build the summary and check the math yourself.

[All free cheat sheets](https://learn.ynteractive.com/content/cheat-sheets) · [All free tutorials](https://learn.ynteractive.com/content)
