Interactive lab · Proof of concept

See your SQL window

What does each row see? Change the window, then walk through the table to find out.

SQL lab · Event ticketing

Explore a synthetic application for buying tickets to events. Customers place orders for event sessions; order items contain ticket quantities and prices. Refunds, campaigns, browsing events and exchange rates complete the picture.

How the models relate

Events belong to partners and have scheduled sessions. Each order can contain several ticket lines and refunds. Campaigns have daily spending and email sends; browsing events can be anonymous or linked to a customer.

flowchart LR
  cities["cities · location and timezone"] -->|city| partners
  cities -->|city| events
  partners -->|partner_id| partner_tier_history
  partners -->|partner_id| events
  events -->|event_id| event_sessions
  customers -->|customer_id| orders["orders · order versions"]
  orders -->|order_id, deduplicate first| order_items
  orders -->|order_id, deduplicate first| refunds
  event_sessions -->|session_id| order_items
  campaigns -->|campaign_id, optional| orders
  campaigns -->|campaign_id| marketing_spend_daily
  campaigns -->|campaign_id| crm_sends
  customers -->|customer_id| crm_sends
  customers -->|customer_id, optional login| web_events
  fx_rates["fx_rates · daily currency rates"] -.->|currency plus as-of order date| orders

Arrows show logical join paths from the dataset generator, not enforced foreign keys. orders contains multiple versions per order_id: deduplicate before joining. Aggregate ticket lines and refunds separately to avoid multiplying amounts. Partner tiers require an effective-date join; exchange rates require currency and an as-of date lookup. The practice data deliberately includes orphan records, duplicate customers and missing weekend rates.

Tables and columns

Loading dataset…

Uncheck to display all rows returned by the SQL, without the previous 200-row cap. A LIMIT written in the SQL still applies. Output limits do not shorten partitions or frames; sample views and WHERE do change the input.

Visual scope: one standalone SUM, AVG, COUNT, ROW_NUMBER, RANK, LAG or LEAD window, with AS alias, on one table (optional WHERE, ORDER BY and LIMIT). Joins, CTEs, multiple windows and other SQL still execute, with results only. Visual partitions are limited to 60 rows. LAG/LEAD offsets must be non-negative integer literals. Ranking highlights show ranking context, not an aggregate frame.