Data Modeling for Analytics
How analytics data is shaped once it lands in a warehouse or lakehouse — facts and dimensions, slowly changing history, and the layered architectures teams build on top of them. Data-engineering and analytics-engineering interviews open here almost every time.
on this pageshowhide
explore
- Dimensional Modeling41 questions
- Facts, Dimensions & Grain6 questions
- Star vs Snowflake Schema6 questions
- Fact Table Types & Additivity6 questions
- Degenerate, Junk & Role-Playing Dimensions6 questions
- Conformed Dimensions & the Bus Matrix6 questions
- Hierarchies & Bridge Tables5 questions
- Aggregate Fact Tables & Rollups6 questions
- Slowly Changing Dimensions & History24 questions
- SCD Types 0–66 questions
- Surrogate Keys & Effective Dating6 questions
- Late-Arriving Dimensions & Facts6 questions
- Implementing SCD in ELT6 questions
- Warehouse Architectures & Layering30 questions
- Kimball vs Inmon6 questions
- Medallion & Lakehouse Layering6 questions
- Data Vault Modeling6 questions
- Data Marts & the Semantic Layer6 questions
- One Big Table & Denormalized Analytics6 questions
- Modeling Practice & Standards23 questions
- Analytics Modeling vs OLTP Normalization5 questions
- Warehouse Keys & Naming Conventions6 questions
- Testing & Documenting Models6 questions
- Evolving a Published Model6 questions
questions
118 · 4 sectionsWhat is an aggregate fact table in a dimensional model, and why keep the atomic fact table too?
basics
~20 sAn aggregate fact table stores the same measures as an atomic fact table, pre-summed to a coarser grain such as month-by-product. It is a derived performance copy; the atomic table stays as the source of truth for detail and rebuilds.
What makes a dimension conformed across two star schemas in a warehouse?
basics
~20 sA conformed dimension is one shared dimension - the same table, or copies with identical keys, attribute names and attribute values - used by several fact tables, so grouping or filtering by it means exactly the same thing in every star.
What is a degenerate dimension, and why does an order number stay in the fact row?
basics
~20 sA degenerate dimension is an operational identifier such as an order or invoice number stored directly in the fact table with no dimension table behind it, because every descriptive attribute it would carry already lives in other dimensions.
What is a role-playing dimension, and how do you join one date dimension three times?
basics
~20 sA role-playing dimension is one physical dimension joined to the same fact table several times under different meanings — order date, ship date and due date — usually exposed as one view or alias per role so column names stay unambiguous.
In a dimensional model, what distinguishes a fact table from a dimension table?
basics
~20 sA fact table holds the numeric measurements of a business process, one row per event at a declared grain, plus foreign keys to dimensions. A dimension table holds the descriptive attributes you filter, group and label by.
In a Type 2 warehouse dimension, why does each version of a row get its own surrogate key?
basics
~20 sBecause facts must point at the version of the dimension that was true when the event happened. The business key identifies the entity for its whole life; the warehouse surrogate key identifies one dated version of that entity.
What is the difference between an SCD Type 1 and an SCD Type 2 change in a dimension table?
basics
~20 sA Type 1 change overwrites the attribute in place, so only the current value exists and history is lost. A Type 2 change retires the old row and inserts a new version, so old facts still report under the value that was true then.
How does a hashdiff column detect changed rows in an SCD Type 2 dimension load?
basics
~20 sA hashdiff hashes the concatenated tracked attributes of an incoming source row and compares that value to the hash stored on the key's current dimension version. Equal means skip the row; different means close the old version and insert a new one.
An early-arriving fact references a customer key absent from the customer dimension — what are your options?
basics
~20 sNever drop the row. Either route the fact to the dimension's reserved unknown member, or — the usual choice — insert an inferred placeholder dimension row carrying the natural key, and enrich it when the real record arrives.
What does an SCD Type 3 previous-value column let a business report?
basics
~20 sAn SCD Type 3 column keeps one prior value beside the current one on the same dimension row, so the same measures can be reported under both the old and the new attribute at once. It captures a realignment, not a timeline.
What is the core difference between the Kimball and Inmon data warehouse architectures?
basics
~10 sInmon builds top-down: one normalized enterprise warehouse integrates every source, and dimensional marts are derived from it. Kimball builds bottom-up: dimensional marts per business process are the warehouse, tied together by shared dimensions.
What is a data mart, and how is it different from the warehouse it draws from?
basics
~20 sA data mart is a subject-area slice of the warehouse: the facts and dimensions one business area needs, named in their vocabulary and owned by someone. The warehouse holds everything; a mart is a curated, governed subset for a specific audience.
What belongs in the bronze, silver and gold layers of a medallion architecture?
basics
~20 sBronze holds source data landed as received, duplicates and quirks included. Silver holds cleaned, typed, deduplicated and conformed entities at a declared grain. Gold holds business-ready output — dimensional models, aggregates and metric tables that reporting queries directly.
What is a one-big-table (OBT) analytics model and what problem does it solve?
basics
~20 sA one-big-table model materialises a fact and all its dimension attributes into a single wide table, so analysts query it without joins. It buys simplicity and consumer safety, and pays in duplication, rebuild cost and lost dimension reuse.
In Data Vault modeling, what do hubs, links and satellites each store?
basics
~20 sA hub holds one row per distinct business key. A link holds a relationship between two or more hubs. A satellite hangs off one hub or one link and holds descriptive attributes plus their load-dated history.
Why is an analytics model deliberately denormalized when its OLTP source schema is normalized?
basics
~20 sThe two schemas are optimized for different jobs. A transactional schema normalizes so concurrent single-row writes stay consistent with one place per fact. An analytics model flattens attributes onto few wide tables so large read-only scans need fewer joins.
Why doesn't a warehouse dimension that copies region names from a source lookup suffer update anomalies?
basics
~20 sBecause nothing updates those copies ad hoc. One scheduled load owns the table, re-derives the region name from the source on each run, and rewrites the affected rows, so the redundancy is recomputable derived data rather than an independent authority.
How do you generate surrogate keys for a warehouse dimension when the platform has no reliable sequence?
basics
~20 sThree families exist: an identity or sequence counter, a deterministic hash over the business key, or a random UUID. Hashing is the usual warehouse choice because it is reproducible, computable in parallel, and survives a full rebuild without renumbering.
Why does a warehouse dimension carry an 'Unknown' member row instead of leaving the fact's key NULL?
basics
~20 sA NULL dimension key drops the fact row from every inner join to that dimension, silently changing totals. A reserved Unknown member row keeps the fact joinable, so measures still add up and the missing value shows as its own visible bucket.
Which changes to a published star schema are backward-compatible for existing reports, and which are not?
basics
~20 sAdditive changes — a new dimension attribute, a new dimension table, a new fact measure — leave existing queries valid. Grain changes, drops, renames and type changes break consumers loudly; redefining what an existing measure means breaks them silently, which is worse.