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.
Write SQL (specify dialect) or describe steps to implement a Type 2 Slowly Changing Dimension for a customer dimension: when a customer's 'tier' changes, create a new row while preserving history. Include recommended constraints and indexes.
You must design a backup/recovery-friendly schema for a large transactional service where some tables must be restorable to a point in time independently (e.g., payments). What schema patterns and DB features help enable per-domain point-in-time recovery with minimal restore time?
For a near-real-time dashboard that requires sub-second response for simple counts and sums, discuss the schema trade-offs between normalized OLTP-style tables and denormalized, pre-aggregated tables. Cover freshness, write amplification, storage cost, and maintenance complexity in your recommendation.
You're given the following simplified e-commerce schema:
customers(customer_id PK integer, name varchar, email varchar, created_at timestamp)
orders(order_id PK integer, customer_id integer FK -> customers(customer_id), total_amount decimal, placed_at timestamp)
order_items(order_item_id PK integer, order_id integer FK -> orders(order_id), product_id integer, quantity integer, price decimal)
Spend a minute examining the schema. List the primary keys and foreign keys, describe the relationships between the tables and their cardinality (one-to-many, many-to-one), and name which columns you would inspect first for data-quality issues and why.
A 'created_at' column is currently stored as TIMESTAMP WITHOUT TIME ZONE. Describe the risks when analyzing data across multiple regions, how you'd normalize timestamps for analysis, and whether you would change the schema or enforce UTC at ingestion. Include a brief SQL example for the Postgres conversion.
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.