Chapter 10 · 8 min · Basic
Deliver a number someone can use
You have checked the table, cleaned what needed cleaning, decided what counts and joined what had to be joined. One step left, and it is the one that decides whether any of the previous work is believed.
A deliverable is not a result grid. It is one row per thing the person asked about, with numbers rounded to a sensible precision, columns named in their language rather than the database's, and the population, the period and the exclusions attached so the number cannot be separated from its meaning.
This chapter builds one, from a request that arrives in the usual shape.
The dataset
Fourteen support tickets from three stores over nine days. minutes_to_first_reply is null for two tickets that were never replied to at all. Two channels are mixed in here — in-app chat, where somebody is watching, and email, where nobody is — and they behave so differently that averaging them together is the first mistake available.
Schema
| ticket_id | int |
| store | text |
| channel | text |
| minutes_to_first_reply | int |
| resolved | boolean |
| opened_on | date |
Example data
The request, and the number that answers nothing
The message: "how fast are we replying to customers?"
The one-line answer is about 80 minutes, and it is nearly useless. Look at what it is made of: two channels with wildly different expectations averaged into one figure, three stores flattened into none, two tickets that never got a reply silently dropped from the denominator, and a single email at 300 minutes dragging everything up.
Eighty minutes describes no ticket, no store and no customer experience. It is the number you get when you type the request into SQL rather than answering it.
So take it apart, using everything from the earlier chapters: what is being measured, over which rows, over what period — and what is missing.
Fourteen tickets, twelve of them with a reply time. Roughly what average do you expect?
Basic
The rest of this chapter is Basic
Learning SQL is free here, forever. This track is the paid half: what to actually do with a dataset once somebody hands you one, from the first look to a number you can defend.
RM 25/mo · cancel anytime
Still to come in this chapter
- 02One row per thing they care about
- 03Choose the population and say so
- 04Let the number carry its own definition
- 05The message you send with it
- 06What else you can do with SQL