Skip to content

Analytics warehouse

Tables an analytics engineer works with: a raw order load with repeats and late updates, a type 2 customer history, daily exchange rates and stock snapshots. 2025.

Query it in the playground

stg_orders

Raw order rows as loaded from the source. The same order can arrive several times: each change in the source sends a new copy, and some loads repeat a copy exactly. No primary key. 669 rows in the larger version, 241 in the smaller.

order_idintOrder id from the source.
customer_idintCustomer id.
order_totalnumeric(10,2)Order total in the order currency.
currencytextUSD, EUR or GBP.
order_statustextplaced, shipped, delivered or cancelled.
updated_attimestampWhen the source last changed this order (UTC).
loaded_attimestampWhen our pipeline loaded this copy (UTC).

dim_customers_history

Type 2 history: one row per version of a customer. A version is valid from valid_from up to, not including, valid_to. Key: customer_id, valid_from. 120 rows in the larger version, 48 in the smaller.

customer_idintCustomer id.
customer_nametextName.
tiertextbronze, silver or gold.
regiontextEMEA, AMER or APAC.
valid_fromtimestampStart of this version (UTC).
valid_totimestamp, nullableEnd of this version (not included). NULL for the current version.

fx_rates

Closing exchange rates on business days only (no weekend rows). Key: rate_date, currency. 254 rows in the larger version, 254 in the smaller.

rate_datedateBusiness day.
currencytextEUR or GBP.
usd_per_unitnumeric(12,6)US dollars for one unit of the currency.

inventory_snapshots

Stock on hand per product at the end of each day. A product missing from a day had no snapshot taken. Key: snapshot_date, sku. 336 rows in the larger version, 173 in the smaller.

snapshot_datedateDay of the snapshot.
skutextProduct code.
on_handintUnits in stock.

Questions on this database