# 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…

Source: https://learn.ynteractive.com/content/sql-monthly-revenue-report · Updated 2026-10-24 · Free from Stepthrough (https://learn.ynteractive.com)

## Practice it step by step

[Start the free practice](https://learn.ynteractive.com/modules/sql-monthly-revenue-report)

[Take the free module: why it matters, practice and a quick check →](https://learn.ynteractive.com/courses/sql-for-business-reports/1)

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, about 12 minutes, and nothing touches your real accounts. [Open full screen](https://learn.ynteractive.com/modules/sql-monthly-revenue-report)

Free · Live now · [SQL](https://learn.ynteractive.com/content/course/sql) · [DB Fiddle](https://learn.ynteractive.com/content/tool/db-fiddle) · ~12 min · 14 steps · Beginner

Updated October 24, 2026. Built against the tool’s current screens and checked step by step. [How we check this lesson](https://learn.ynteractive.com/content/about#how-we-check)

A beginner [SQL](https://learn.ynteractive.com/content/glossary/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](https://learn.ynteractive.com/content/glossary/group-by), typing every line yourself.

## At a glance

| Question | Answer |
| --- | --- |
| What you build | 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. |
| Tools | DB Fiddle |
| Time | About 12 minutes, 14 steps in 3 parts |
| Level | Beginner, no coding needed |
| Cost | Free |
| Ways to learn it | [Practice it step by step](https://learn.ynteractive.com/modules/sql-monthly-revenue-report) |

### The 3 parts, in short

1. Make the orders table: Click in Schema SQL, Create the orders table, Add the first two orders, Add three more orders, and 1 more step.
2. Ask your first questions: Ask for every order, Run it, Only September, Run it, and 2 more steps.
3. Revenue by month: Pick the month and the total, Group by month, Run the report.

## What you'll build

Priya (made up) is the office manager at Lakeside Office Supply. Every month-end the owner asks the same thing: how much did we sell, and how did each month do? Today she copies the orders into a spreadsheet and adds them up by hand, which takes most of an hour and goes wrong when a row is missed. In this lesson you type a small orders table into [DB Fiddle](https://learn.ynteractive.com/content/tool/db-fiddle), a free database in your browser, and write four short queries: all orders, September only, the quarter's total and revenue by month. You type every line yourself.

Eight orders, $11,340 for the quarter: July $4,250, August $3,930 and September $3,160. The same four queries work on 8 orders or 80,000, and next month you only run them again. Do it in DB Fiddle yourself: the lesson page has the checklist.

- Tools: DB Fiddle
- Time: about 12 minutes, 14 steps in 3 chapters
- Level: beginner, no coding needed
- Price: free

## Practice first, then build it for real

Practice copy built from real DB Fiddle screens (db-fiddle.com, MySQL v9, captured 24 October 2026). Every query in it was typed and run there. The shop, its customers and its orders are made up; the ad box on the left is blurred. To build it for real you need your own DB Fiddle account, and some services charge once you use them for real work, so check each tool's current pricing.

## Try it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive module walks you through every click in a practice copy of DB Fiddle, checks each step, and never touches your real accounts.

[Start “SQL: Build a Monthly Revenue Report from an Orders Table”](https://learn.ynteractive.com/modules/sql-monthly-revenue-report)

## Step by step: SQL: Build a Monthly Revenue Report from an Orders Table

All 14 steps of the interactive module, in order. In the module you watch each one, then do it yourself in a practice copy that checks your work.

### 1. Make the orders table

1. **Click in Schema SQL.** Open **db-fiddle.com** (no account needed). The left box, **Schema SQL**, is where the table goes. Click inside it.
   This is DB Fiddle, a free database in your browser.
2. **Create the orders table.** Type these three lines. They make an empty table with four columns: an id, the order date, the customer and the amount. In the practice you can type it on one line; in DB Fiddle press Enter between lines.
3. **Add the first two orders.** Leave a blank line, then type the INSERT line and the first two orders. Text goes in single quotes; numbers do not.
   Names in single quotes.
4. **Add three more orders.** Type the next three orders. Each row ends with a comma.
   Three more orders. Each row ends with a comma.
5. **Add the last three orders.** Type the last three. The very last row ends with a semicolon instead of a comma: that tells the database the statement is finished.
   The last three orders. The very last one ends with a semicolon, not a comma.

### 2. Ask your first questions

6. **Ask for every order.** Click in the right box, **Query SQL**, and type your first question: show everything in the orders table. The star means all columns.
   In the Query SQL box, type SELECT star FROM orders. The star means every column.
7. **Run it.** Click **Run** at the top. DB Fiddle builds the table from the left box, then runs your query.
8. **Only September.** Eight rows: the whole quarter. Now just September. Select the query (Ctrl+A) and type over it. **WHERE** keeps only the rows that match.
   Eight orders. Now replace the query with one that keeps only September, using WHERE.
9. **Run it.** Click **Run**.
   Run it.
10. **Count and total the quarter.** Two September orders. Now the whole quarter in one line of numbers. COUNT(*) counts rows, **SUM(amount)** adds them up, and **AS** names each result column. Replace the query with the code shown below.
    Two in September. Now count and total the whole quarter with COUNT and SUM.
11. **Run it.** Click **Run**.
    Run it.

### 3. Revenue by month

12. **Pick the month and the total.** 8 orders, **$11,340**. Now split it by month. Replace the query and type the first three lines. **DATE_FORMAT** turns 2026-07-02 into 2026-07, so every July order gets the same label.
    Eleven thousand three hundred forty for the quarter. DATE FORMAT turns each date into its month.
13. **Group by month.** Add two lines. **GROUP BY month** makes one row per month and adds up each month's orders; **ORDER BY** puts them in date order.
    Add GROUP BY month, and ORDER BY month.
14. **Run the report.** Click **Run**.
    Run the report.

## Screenshots

[Start this module free](https://learn.ynteractive.com/modules/sql-monthly-revenue-report)

- Next in SQL: [SQL: Top Customers and Key Accounts with GROUP BY and HAVING](https://learn.ynteractive.com/content/sql-top-customers)

## More in SQL

- [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…

[All 3 modules in SQL](https://learn.ynteractive.com/content/course/sql)

## Same business, other tools

Maple Dental shows up in these modules too, built with different tools.

- [Excel for the Web: Find Your Top Customers in a Sales Export](https://learn.ynteractive.com/content/excel-web-top-customers): A beginner Excel for the web walkthrough on real screens: clean a sales export with Remove Duplicates, total every customer with a PivotTable and sort the biggest to…
- [JavaScript: Turn Invoice Dates into Due-Date Reminders](https://learn.ynteractive.com/content/js-due-date-reminders): A beginner JavaScript walkthrough in the free JSFiddle: work out Net 30 due dates, count the days left and list every invoice as due or overdue, typing every line…
- [Python: Total a Sales Export by Customer in Google Colab](https://learn.ynteractive.com/content/python-sales-report): A beginner Python walkthrough in the free Google Colab: put six orders in a pandas table, total the quarter and rank customers by revenue, typing every line yourself.
- [Python: Combine Monthly Sales Exports into One Quarter](https://learn.ynteractive.com/content/python-combine-exports): A beginner Python walkthrough in the free Google Colab: label three monthly exports, stack them into one quarter with pandas concat and total by month and by customer…

## Free cheat sheet

Print it or save the PDF: the key steps and checks from this lesson on one page, free.

- [SQL Business Reports Cheat Sheet](https://learn.ynteractive.com/content/cheat-sheets/sql-business-reports): 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.

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

## Terms in this lesson

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)

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

## Browse related tutorials

[SQL (3)](https://learn.ynteractive.com/content/course/sql) · [DB Fiddle tutorials (3)](https://learn.ynteractive.com/content/tool/db-fiddle)

Want AI working like this in your business? Robert Breen, the instructor behind this lesson, helps small and mid-sized teams put AI assistants, agents and automations to work. [See Ynteractive’s AI consulting](https://ynteractive.com/)
