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.
Explain how bitmap and B-tree indexes differ. For a large dimension table with low-cardinality columns (e.g., gender, boolean flags), which index type would you choose and why? Mention concurrency considerations.
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.
You inherit a reporting schema where many dimension tables have nullable surrogate foreign keys to a central 'master' table. Query performance suffers from many LEFT JOINs producing repeated nulls. Propose schema and query-level optimizations to reduce join cost and simplify reporting queries.
Define grain in dimensional modeling. Provide three examples of different fact table grains for an online retail business and explain one practical consequence of choosing a too-coarse or too-fine grain.
Explain the difference between 1NF, 2NF, and 3NF. Give a concrete example table (columns and sample rows) that violates 2NF and show how to transform it into 2NF.
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.