Many people think data analysis means building charts. In practice the charts come last. On a table with thousands of orders, the hard part is knowing which question to answer and which rows to trust. To see how the work fits together, we follow one small case through five steps. A manager asks, "How did October go compared with September?" The numbers come from an orders table with 15 rows, so you can check every figure by hand.
Step 1: turn the request into a question
"How did October go" can mean revenue, the number of orders or the number of customers. This is a definition problem, and each reading gives a different number. We choose revenue from paid orders as the main figure. We also track the number of orders, because revenue alone can hide a change in volume.
Step 2: get the data and check its size
We need one row per order, with the date, the amount and the status. The orders table has all three. Before we use it, we count the rows and the distinct order IDs. If the two numbers differ, some orders appear twice.
SELECT COUNT(*) AS n_rows, COUNT(DISTINCT order_id) AS n_orders
FROM orders;
-- n_rows = 15, n_orders = 15Both numbers are 15, so every row is one order.
Step 3: clean the rows you cannot count
One order, number 14, has the status cancelled and an amount of 9,000,000. If we leave it in, October shows 7 orders and 95,000,000. If we keep only paid orders, October shows 6 orders and 86,000,000. The choice moves the answer by 9 million, so we write it down as a rule. Only status = 'paid' counts as a sale.
Step 4: analyse
To compare the two months, we group the paid orders by month. We add the average order value, because it explains how revenue and order count can move in different directions.
SELECT substr(order_date, 1, 7) AS month
, COUNT(*) AS n_orders
, SUM(total_amount) AS revenue
, SUM(total_amount) / COUNT(*) AS avg_order
FROM orders
WHERE status = 'paid'
GROUP BY 1
ORDER BY 1;| Month | Orders | Revenue | Average order |
|---|---|---|---|
| 2026-09 | 8 | 72,000,000 | 9,000,000 |
| 2026-10 | 6 | 86,000,000 | 14,333,333 |
Revenue rose by 19.4%, but the number of orders fell by 25%. One order of 20,000,000 makes up 23% of October revenue. So the growth rests on a few large orders, not on more buyers.
Step 5: explain the result
A good answer starts with the number and ends with the caveat. For this case we could write the following. "October revenue from paid orders was 86 million, up 19% on September. Orders fell from 8 to 6. One 20 million order makes up 23% of the month, so the growth rests on a few large orders." A manager can act on that sentence, and a colleague can check it against the table.
The five steps at a glance
| Step | What we do | In this case |
|---|---|---|
| 1 | Define the question | Revenue from paid orders, plus order count |
| 2 | Get the data and check its size | 15 rows, 15 distinct order IDs |
| 3 | Clean | Exclude the cancelled order |
| 4 | Analyse | Group by month, add average order |
| 5 | Explain | Number first, caveat second |


