DataEng Hub
Data modelingintermediateArticle · 8 min read

Data Modeling Interview Questions: 20 Design Problems with Answers

Twenty scenario-based data modeling problems asked in data engineer and analytics engineer interviews, with what the interviewer is checking and a strong answer for each.

Balaji S.
Lead Data Engineer

TL;DR

  • Data modeling interviews are rarely "define a star schema". They're "here's a business, design the tables", and the interviewer is watching how you reason.
  • Say the grain out loud first. It's the single habit that most separates strong candidates from average ones.
  • Every answer below has three parts: the scenario, what's actually being tested, and a strong answer you can adapt.
  • The problems are grouped into five areas: grain and facts, dimensions and history, keys and integrity, lakehouse physical design, and architecture trade-offs.

How to answer any modeling question

I've sat on both sides of these interviews for a long time, and good answers follow the same shape:

  1. Clarify the questions the business will ask. Two or three example queries are enough.
  2. State the grain of each fact table in one sentence.
  3. List dimensions and measures, and say which measures are additive.
  4. Call out history: which attributes need SCD Type 2.
  5. Mention one edge case (late data, unknown members, many-to-many) before you're asked.

Interviewers forgive a missed detail. They don't forgive jumping straight to column names without asking what the tables are for.

Map of 20 data modeling interview problems grouped into five areas Twenty problems across five areas. Grain shows up in almost all of them.

Grain and facts

1. Design the core fact table for a ride-hailing app. Testing: Can you pick a grain and defend it? Strong answer: One row per completed or cancelled trip. Dimensions: rider, driver, vehicle, pickup zone, drop-off zone, request date and time, payment method. Measures: fare, tip, distance, duration, surge multiplier components. I'd keep cancelled trips with a status dimension rather than a separate table, so cancellation rate is one query. GPS pings are a separate, much finer-grained fact.

2. An order has a shipping charge, and the order has five lines. Where does shipping go? Testing: Mixed grain awareness. Strong answer: Not copied onto each line, or SUM multiplies it by five. Either allocate it across lines (by value or weight) so the line-grain fact stays additive, or create an order-header grain fact. I'd ask finance how they report shipping before choosing.

3. Model daily account balances for a bank. Testing: Periodic snapshots and semi-additive measures. Strong answer: A periodic snapshot: one row per account per day, including days with no transactions. Balance is semi-additive. You can sum across accounts, never across days; use end-of-period or average. Transactions live in a separate transaction fact, which reconciles with the snapshot.

4. The business wants to know where online orders get stuck between payment and delivery. Testing: Accumulating snapshots. Strong answer: One row per order with a date key and timestamp per milestone (paid, picked, packed, shipped, delivered) plus lag measures between them. The row is updated with MERGE as milestones happen. If orders can loop through steps repeatedly, I'd use a status-change transaction fact instead.

Dimensions and history

5. Report sales by customer's city at the time of sale, and also by current city. Testing: SCD Type 2 and Type 6. Strong answer: Type 2 on city so each fact points at the version valid when it happened. Add a current_city column overwritten on every version (Type 6) so "by current city" doesn't need a self-join.

6. Product price changes every day. Do you track it with SCD Type 2 on the product dimension? Testing: Knowing what doesn't belong in a dimension. Strong answer: No. A daily-changing value would create 365 versions per product per year. Actual selling price belongs on the sales fact. List price history, if needed, goes in its own periodic snapshot or a price fact.

7. Customer age band, income band and loyalty score change often. The customer dimension is 50 million rows. Testing: Mini-dimensions. Strong answer: Move the volatile, banded attributes into a mini-dimension containing every combination that occurs, maybe a few thousand rows. The fact carries both customer_key and customer_profile_key. The big dimension stops churning versions.

8. A bank account can have several owners, and a customer can own several accounts. Testing: Many-to-many and bridge tables. Strong answer: A bridge table between account and customer, with an allocation or weighting factor so balances can be split without double counting. I'd point out that summing balances by customer without the weighting double-counts joint accounts.

9. Model an employee reporting hierarchy that's uneven: some teams are three levels deep, others seven. Testing: Ragged hierarchies. Strong answer: A hierarchy bridge (closure table) with one row per ancestor–descendant pair and a depth column. This lets "everything under this VP" be one join. For BI tools that want fixed levels, also provide a flattened view with level_1 … level_n filled down.

Keys and integrity

10. Customers come from a CRM and an e-commerce platform with different IDs for the same person. Testing: Conformed dimensions and identity resolution. Strong answer: A conformed dim_customer with one surrogate key per real person, fed by a mapping table from each source ID to that key. The matching logic (email, phone, fuzzy name) lives upstream in silver. Keep both source IDs on the dimension for traceability.

11. How do you generate surrogate keys on Delta Lake? Testing: Practical lakehouse knowledge. Strong answer: Identity columns for single-writer dimensions: compact and collision-free, but they don't allow concurrent writes. Hash keys (xxhash64 or sha2) when multiple jobs write or rebuilds must be reproducible; mention collision risk at very high cardinality. Never monotonically_increasing_id() for persistent keys.

12. A sale arrives for a customer who isn't in the dimension yet. Testing: Late-arriving dimensions. Strong answer: Create an inferred member: a placeholder row with the natural key and an is_inferred flag. The fact gets a real key. When the real customer arrives, update that row in place instead of creating a Type 2 version. Fall back to -1 plus a re-keying sweep for anything missed.

13. Your event source delivers at-least-once. How do you stop duplicate facts? Testing: Idempotency. Strong answer: Use a stable event ID as the deduplication key. Deduplicate within the batch, then MERGE into the fact with WHEN NOT MATCHED THEN INSERT only. In streaming, dropDuplicatesWithinWatermark handles duplicates within a time bound. Reruns of the same batch must change nothing.

Lakehouse physical design

14. A fact table has 5 billion rows. Queries filter by date and store. How do you lay it out? Testing: Delta physical design. Strong answer: Liquid clustering on date_key, store_key. I'd avoid partitioning by day unless the table is many terabytes, because small partitions create small files. Keep foreign keys as BIGINT, and check that OPTIMIZE runs regularly or predictive optimization is enabled.

15. A customer asks to be forgotten under GDPR. They appear in an SCD2 dimension and in Delta time travel. Testing: Governance awareness. Strong answer: Delete or anonymise their rows in every version of the dimension, then VACUUM so old files holding their data are removed after the retention period. Time travel can't be relied on to keep that data. A cleaner design keeps PII in a separate, small table keyed by surrogate key, so erasure touches one table.

16. Sales happen in INR, USD and AED. Leadership wants one revenue figure. Testing: Multi-currency modeling. Strong answer: Store the transaction currency amount and a currency key on the fact. Keep a daily exchange rate fact. Either store a reporting-currency amount computed at the transaction date, or convert at query time when the business wants today's rates. Ask which one finance wants, because they give different numbers.

17. Stores are in four time zones. What's the date of a sale at 11:30 p.m.? Testing: Time handling. Strong answer: Store the event timestamp in UTC and a local date key derived using the store's time zone. Business reporting uses the local date ("Tuesday's sales"); cross-system analysis uses UTC. Both columns, never just one.

Architecture trade-offs

18. When would you choose Data Vault over a Kimball model? Testing: Knowing what each is for. Strong answer: Data Vault when there are many source systems, sources change often, and auditability matters, usually in the integration (silver) layer. Kimball for presentation. Most large estates use both. For a small team with a few sources, Data Vault is mostly overhead.

19. Analysts want one huge denormalised table for their dashboard. Do you build it? Testing: Pragmatism. Strong answer: Yes, as a derived table from the star schema, owned by that dashboard, rebuilt incrementally. Not as the only model, and never built straight from silver, or business logic forks.

20. Sensors send a reading every second from 200,000 devices. Model it for analytics. Testing: Exploding grain. Strong answer: Raw readings in a transaction-grain table clustered on device and time, with short retention at full detail. A periodic snapshot at minute or hour grain with min, max, average and count for most analytics. A device dimension with location and type. Most queries never touch raw seconds.

From production: what actually trips candidates

  1. Jumping to DDL. Writing column lists before stating the grain. Always say the grain first.
  2. Treating SCD Type 2 as the default. Strong candidates say which attributes need history and why.
  3. Forgetting NULL keys. Mentioning unknown and not-applicable members unprompted signals real experience.
  4. No numbers. Estimating row counts ("600 stores × 25,000 products × 365 days is 5.5 billion rows") turns a vague answer into an engineering answer.

Checklist

  • Can state a grain for any process in one sentence
  • Can explain additive, semi-additive and non-additive with examples
  • Can draw a Type 2 dimension and explain how facts join to it
  • Can explain bridge tables and mini-dimensions
  • Can name two surrogate key strategies on Delta and their trade-offs
  • Can handle late-arriving data both ways round

Practice

Further reading

#data-modeling#interview#star-schema#scd#fact-tables#system-design

Keep going

One practical note a week

Get new articles, problems and guides in your inbox.