Knowing SQL is half the job. The other half is turning a vague question from a manager into precise queries, checking the results, and explaining what they mean. Here's the full process on a real question.
“We've been pushing WhatsApp orders. Is it working? Should we keep investing?” — PsalmEdu Mart's Head of Sales
1. Make the question precise
“Working” could mean several things. Break it into questions SQL can answer:
- Is the number of WhatsApp orders growing?
- Are WhatsApp orders as valuable as walk-in orders?
- Are they cancelled more often?
Write the definitions down: orders = all statuses for volume; value = delivered revenue per order. Agreeing definitions first saves arguments later.
2. Query each part
Growth — orders per channel per year:
SELECT strftime('%Y', order_date) AS year, channel, COUNT(*) AS orders
FROM orders
GROUP BY year, channel
ORDER BY year, channel;
WhatsApp: 282 orders in 2025, 642 in 2026 — and 2026 only runs to the end of October in this data. Compare like with like: you'd check January–October in both years before claiming a precise growth rate.
Value — average delivered order by channel:
WITH t AS (
SELECT o.order_id, o.channel, SUM(oi.quantity * oi.unit_price) AS total
FROM orders o
JOIN order_items oi ON oi.order_id = o.order_id
WHERE o.status = 'Delivered'
GROUP BY o.order_id, o.channel
)
SELECT channel, COUNT(*) AS orders, ROUND(AVG(total)) AS avg_order, SUM(total) AS revenue
FROM t
GROUP BY channel;
WhatsApp ₦17,055 per order, walk-in ₦17,604, website ₦18,880. Very similar baskets.
Cancellations — the CASE query from lesson 5.1: WhatsApp 6.0%, walk-in 6.3%. No problem there.
3. Check before you trust
- Do channel totals add up to the overall total (₦47,738,300 delivered)? 25,754,800 + 7,759,550 + 14,223,950 — yes.
- Spot-check one order by hand in Browse Data.
- Look for oddities: NULLs, unexpected statuses, dates in the future.
4. Say what it means
WhatsApp is working. WhatsApp orders more than doubled from 2025 to 2026 (282 → 642, with two months of 2026 still to come), now bring in nearly ₦14.2 million of delivered revenue, and are as valuable and as reliable as walk-in orders. Recommendation: keep investing; next, check whether WhatsApp is bringing new customers or moving existing walk-in customers online.
Notice: lead with the answer, give two or three numbers, end with a recommendation and the next question. Managers rarely want to see the SQL — but keep it saved, because someone will ask “how did you get that?”
SQL in job interviews
Nigerian data and analyst interviews usually include a live SQL test. The favourite topics are exactly this course: GROUP BY with HAVING, a LEFT JOIN to find missing records, a top-N-per-group with ROW_NUMBER, and a running total. Talk through your thinking out loud as you write — interviewers care about how you approach the problem.
Check yourself
Answer in your head first, then open each question to see the answer and why.
What's the first step when a manager asks a vague question?
- A Break it into precise questions and agree definitions
- B Write the longest query possible
- C Export everything to Excel
- D Ask IT to do it
Show the answer
A) Break it into precise questions and agree definitions — Clear questions and definitions lead to clear answers.
Why compare January–October 2025 with January–October 2026, rather than all of 2025 with 2026 so far?
- A To compare like with like
- B Because 2025 has no data
- C SQL can't handle full years
- D It doesn't matter
Show the answer
A) To compare like with like — Comparing a full year with ten months would understate growth.
How should you present findings to a manager?
- A Lead with the answer, a few key numbers and a recommendation
- B Paste the SQL and the raw results
- C Show every query you tried
- D Only say "it's in the database"
Show the answer
A) Lead with the answer, a few key numbers and a recommendation — Busy managers need the conclusion first.
More free lessons: What SQL is, and why employers want it · Install DB Browser and open the practice database · WHERE: only the rows you need · COUNT, SUM, AVG, MIN and MAX · INNER JOIN: combine two tables · CASE: if-then logic inside a query · INSERT, UPDATE and DELETE — safely