Zellio.io

Data Wrangling in SQL

Every puzzle creates a few small tables and describes the result it wants: the columns, the rows, sometimes the order. You write the query; DuckDB runs it in this tab; the result is compared with the expected one cell by cell. The tables are reset before each attempt, so nothing you do to them lasts.

Practises the CSV & SQL Data Playground. Answers are checked here; nothing is sent anywhere.

Puzzle 1

Shipped orders

List the id and customer of every shipped order, lowest id first.

Tables

  • ordersid, customer, product, qty, price, ordered (YYYY-MM-DD text), status

Expected result (in this order)

idcustomer
1Acme
2Globex
5Globex
DuckDB loads on first run (~30 MB, cached after)Ctrl+Enter runs · tables are reset before every run

What the comparison checks

Column names, compared without regard to case, so name the output columns as the puzzle asks; a puzzle that wants revenue does not accept sum(qty * price). Row count. Then every cell, rendered as text the same way the result table renders it: integers as digits, decimals trimmed, NULL as NULL. Where the puzzle does not specify an order, rows are sorted before comparing, so an ORDER BY is optional there; where it does, the order is part of the answer.

The engine

DuckDB runs as WebAssembly in this tab, the same engine as the Data Playground. It downloads once, around thirty megabytes, and is cached by the browser afterwards. It speaks standard SQL with a rich function library: window functions, CASE, subqueries, date arithmetic on cast text, string functions. The puzzles are written so that ordinary SQL solves them; DuckDB-specific shortcuts are allowed but never required.

Working a puzzle

  • Read the schema panel; the column names are exact.
  • Run a SELECT * on the table first to see the rows. Every attempt resets the tables, so exploring is free.
  • Match the expected column names with AS.
  • When a cell differs, the message names the row and column; look at that one value rather than rewriting the query.
  • For a puzzle you cannot crack, the reference query can be revealed, and it is worth reading as one way rather than the way.

Questions

Can I load my own data?
Not here; the puzzles are fixed. The Data Playground reads your own CSV and Parquet files with the same engine and the same SQL.
The engine takes a while to load.
The first visit downloads about thirty megabytes of WebAssembly; after that it comes from the browser cache. The download bar is honest about progress.

Other labs