Updated . Built against the tool’s current screens and checked step by step. How we check this lesson
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.
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 |
The 3 parts, in short
- 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.
- Ask your first questions: Ask for every order, Run it, Only September, Run it, and 2 more steps.
- 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, 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”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
- 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.
- 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.
- 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.
- Add three more orders. Type the next three orders. Each row ends with a comma.
Three more orders. Each row ends with a comma.
- 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
- 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.
- Run it. Click Run at the top. DB Fiddle builds the table from the left box, then runs your query.
- 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.
- Run it. Click Run.
Run it.
- 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.
- Run it. Click Run.
Run it.
3. Revenue by month
- 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.
- 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.
- Run the report. Click Run.
Run the report.
Screenshots













More in 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 ExportA 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…
Free · Live ~12 min Beginner
JavaScript: Turn Invoice Dates into Due-Date RemindersA 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…
Free · Live ~15 min Beginner
Python: Total a Sales Export by Customer in Google ColabA 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.
Free · Live ~12 min Beginner
Python: Combine Monthly Sales Exports into One QuarterA 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 · Live ~12 min Beginner
Free cheat sheet
Print it or save the PDF: the key steps and checks from this lesson on one page, free.
All free printable cheat sheets
Terms in this lesson
Plain-English definitions, each with an example from a free lesson.

