InterviewStack.io LogoInterviewStack.io

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.

EasyTechnical
40 practiced

Explain the difference between a PRIMARY KEY and a UNIQUE constraint in a relational database. Cover purpose, nullability, index behavior, referencing by foreign keys, and typical usage patterns. Give examples showing (a) a primary key on a single column, (b) a unique constraint on a nullable column, and (c) creating a unique index manually. Discuss practical choices such as composite keys and partial unique indexes.

EasyTechnical
37 practiced

Describe partitioning and its benefits for very large tables used in analytics. Explain range, hash, and list partitioning in simple terms and when each is useful. What maintenance operations must you consider for partitioned tables?

MediumSystem Design
52 practiced

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.

EasyTechnical
33 practiced

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.

HardTechnical
30 practiced

Propose schema patterns to add auditing and change-tracking to tables for traceability. What columns and structures would you add to capture who changed a row and when, and what approach would you use for row-level history: a separate audit table, database-level change data capture, or an append-only pattern? Discuss the queryability and performance trade-offs of each history-tracking approach.

Unlock Full Question Bank

Get access to all Data Modeling and Schema Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.