Starting the database in your browser

  1. Loading DuckDB (WebAssembly)
  2. Downloading sales data
  3. Building tables
  4. Running 10 SQL queries
Retail SQL Analytics Code

SQL · DuckDB · runs entirely in your browser

A million sales lines,
queried live as you watch.

Two years of real transactions from a UK online gift retailer (many of its customers are wholesalers), cleaned with SQL and analysed with ten SQL queries. There is no server: the whole database runs in this tab, so every filter you change re-runs the SQL on the spot. Open the SQL tab on any chart to read the query behind it.

Starting DuckDB…
  1. 01Raw Excel2 sheets, UCI archive
  2. 02Clean with SQLetl/clean.sql in DuckDB
  3. 03Parquet5.4 MB, columnar
  4. 04DuckDB-WASMdatabase in your browser
  5. 0510 SQL files→ these charts

01 — Overview

The business at a glance

02 — Markets & products

Where, what and when people buy

03 — Customers

Who carries the shop, and who comes back

Customer analyses use lines with a customer ID. About 22% of lines (14% of revenue) have none and are left out of this section.

04 — Baskets & returns

What sells together, and what comes back

05 — Playground

Write your own SQL

The full database is loaded in this tab. Try a sample or write your own query, then press Ctrl + Enter. The sales view follows the filters above; sales_all is always the full table.

Ctrl + Enter to run