Stepthrough Start free

SQL: Build a Monthly Revenue Report from an Orders Table

Practice it step by step

Start the free practice

Take the free module: why it matters, practice and a quick check →

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

Free · Live nowSQLDB Fiddle~12 min14 stepsBeginner

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

QuestionAnswer
What you buildA 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.
ToolsDB Fiddle
TimeAbout 12 minutes, 14 steps in 3 parts
LevelBeginner, no coding needed
CostFree
Ways to learn itPractice it step by step

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.
DB Fiddle with empty Schema SQL and Query SQL boxes, MySQL v9 selected
DB Fiddle with empty Schema SQL and Query SQL boxes, MySQL v9 selected

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

  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

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

  2. Run it. Click Run at the top. DB Fiddle builds the table from the left box, then runs your query.
  3. 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.

  4. Run it. Click Run.

    Run it.

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

  6. Run it. Click Run.

    Run it.

3. Revenue by month

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

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

  3. Run the report. Click Run.

    Run the report.

Screenshots

Start this module free

More in SQL

All 3 modules in SQL

Same business, other tools

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

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

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

The full AI glossary

Browse related tutorials