Skip to content
Mermaid templates

Star Schema

Canonical star — fact_sales at the centre, dimensions around it.

Template previewMermaid
Rendering…

Make it your own.

erDiagram
FACT_SALES }o--|| DIM_DATE     : "sale_date"
FACT_SALES }o--|| DIM_CUSTOMER : "customer_id"
FACT_SALES }o--|| DIM_PRODUCT  : "product_id"
FACT_SALES }o--|| DIM_STORE    : "store_id"
FACT_SALES }o--|| DIM_PROMO    : "promo_id"

FACT_SALES {
  uuid sale_id PK
  date sale_date
  uuid customer_id
  uuid product_id
  uuid store_id
  uuid promo_id
  int quantity
  numeric net_amount
}
DIM_DATE     { date date PK   int day_of_week int month int year text holiday }
DIM_CUSTOMER { uuid id PK     text segment text country }
DIM_PRODUCT  { uuid id PK     text sku text category text brand numeric list_price }
DIM_STORE    { uuid id PK     text city text region }
DIM_PROMO    { uuid id PK     text channel numeric discount_pct }