Data Modeling and Schema Design Questions
Designing relational schemas end to end: entity-relationship modeling, normal forms and deliberate denormalization, primary/foreign keys, data types, and integrity constraints, together with applied schema design driven by real business requirements and query access patterns. Covers modeling a domain from ambiguous requirements, choosing structures that serve the queries a system must run, trading normalization for correctness against denormalization for read performance, and evolving schemas as needs change. Foundational data-modeling judgment for building and reviewing databases, tested through open-ended domain-modeling prompts.
Consider this order_items table definition:
order_items(order_id INT, product_id INT, quantity INT, price NUMERIC)
where the combination (order_id, product_id) forms the logical primary key. Explain how composite primary keys work, demonstrate how you'd join this table to orders and products, and describe when you might prefer adding a surrogate key (order_item_id) instead.
A data pipeline writes to a warehouse where fact and dimension tables are stored in a columnar format. The team needs to support fast lookups of a small subset of rows (point selects) as well as large scans. What schema and physical design choices reduce latency for point selects without harming scan performance?
Design a schema to store customer addresses that supports: a current-address lookup, a historical audit of changes with timestamps, queries like 'what was the address at time T', and efficient deletion and retention. Propose the table(s), primary keys, and indexing strategy, and explain the trade-offs related to storage and query cost.
A data warehouse team asks you whether to use surrogate integer keys or natural keys for dimension tables. Discuss pros and cons and your recommendation for large-scale analytics (hundreds of millions of rows).
Explain primary keys, surrogate keys, and natural keys. When designing schemas for customers and orders in a large OLTP system, when would you choose a surrogate key (auto-increment bigint or UUID) versus a natural key (email, national ID)? Discuss trade-offs: uniqueness guarantees, join performance, index size, replication/merge complexity, human-readability, and give examples where each is appropriate.
Unlock Full Question Bank
Get access to all Data Modeling and Schema Design interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.