- Problem
- SQL skills are difficult to demonstrate through screenshots of queries alone. I wanted an accessible way for someone to inspect a dataset, run SQL, and see the results directly in a browser.
- Solution
- I built a SQLite database from the retail dataset and published it as a browser-based explorer, with working tables, four KPI views, metadata, and executable SQL examples.
- Result
- A working, read-only SQL demonstration where visitors can run queries, inspect results, and compare selected measures with the companion Excel reporting project.
- Evidence
- The live demo, the KPI views, and the worked queries below, which were run against the demo database.
What it is
A browser-based SQL demonstration built around a retail transactions dataset, with working tables, reusable KPI views, and executable SQL examples. It also serves as a companion to my Excel reporting project, using the same dataset to examine selected measures from another angle.
Datasette Lite supplies the in-browser SQL interface; the data preparation, tables, views, metadata, queries, and hosting are mine.
- Raw table:
transactions - Working layer:
working_transactions, which mirrors the Excel driver columns - KPI views:
kpi_checks_summary,kpi_monthly,kpi_channel,kpi_status_distribution
The KPI logic is defined once in working_transactions and rolled up into the views, so the SQL views stay internally consistent and traceable to the same definitions used in the Excel workflow. I reconciled the SQL views against the companion Excel reporting project.
Worked query: cancellation rate
Question: Which sales channel has the highest cancellation rate?
SELECT sales_channel, line_items, cancel_pct, return_pct, completion_pct
FROM kpi_channel
ORDER BY cancel_pct DESC;
Result:
| sales_channel | line_items | cancel_pct | return_pct | completion_pct |
|---|---|---|---|---|
| Online | 305 | 36.39 | 46.89 | 28.20 |
| Mobile app | 368 | 33.97 | 47.83 | 34.78 |
| In-store | 327 | 32.42 | 43.43 | 35.78 |
Interpretation: Online has the highest cancellation rate at 36.39%, and In-store the lowest at 32.42%. The gap is small, so channel alone does not explain the cancellations. Online also has the lowest completion rate at 28.20%, which is worth a closer look. These figures describe the simulated dataset, not a real retailer.
Second worked query: monthly net revenue
Question: How does completed-line net revenue move by month?
SELECT month, net_revenue, line_items, completion_pct,
ROUND(net_revenue / line_items, 2) AS revenue_per_line
FROM kpi_monthly
ORDER BY month;
Result:
| month | net_revenue | line_items | completion_pct | revenue_per_line |
|---|---|---|---|---|
| 2024-08 | 66,181.90 | 147 | 31.29 | 450.22 |
| 2024-09 | 78,747.05 | 181 | 34.25 | 435.07 |
| 2024-10 | 72,596.14 | 145 | 35.17 | 500.66 |
| 2024-11 | 64,823.14 | 174 | 31.03 | 372.55 |
| 2024-12 | 87,574.31 | 185 | 33.51 | 473.37 |
| 2025-01 | 77,980.17 | 168 | 33.33 | 464.17 |
Interpretation: December has the highest completed-line net revenue. Completion rates stay close to one third each month. November has more line items than October but the lowest revenue per line, so volume alone does not explain the monthly movement.
Reconciliation
The kpi_checks_summary view records the same totals the Excel Checks layer uses, so the two projects can be compared. It reports 1,000 line items, gross line revenue of 1,386,089.47, completed-line net revenue of 447,902.72, 331 completed lines and 342 canceled lines.
Limitations
- The dataset is simulated. It does not represent a real retailer.
- The explorer is read-only by design. It demonstrates querying and inspection, not a production database.
- Channel differences are small and are not evidence of a cause.