InterviewStack.io LogoInterviewStack.io

Relational Database Fundamentals and Design Questions

Core concepts of relational databases and schema design including tables, relationships such as one to one one to many and many to many, primary keys and foreign keys, data integrity constraints, and the properties of atomicity consistency isolation and durability and why they matter. Understand differences between relational systems using structured query language and nonrelational databases, indexing strategies, normalization and denormalization trade offs, simple query optimization techniques, and when to choose a normalized relational design versus a document or key value store. Candidates should be able to perform basic entity identification, produce simple schema diagrams, explain persistence and durability considerations, and reason about basic performance and scaling trade offs.

MediumTechnical
21 practiced
You have frequent queries that filter by combinations of columns a,b and order by c. Given queries:1) WHERE a = ? AND b = ? ORDER BY c DESC2) WHERE b = ? AND c = ?3) WHERE a = ? ORDER BY bExplain how to design composite indexes using the leftmost-prefix rule and INCLUDE columns (Postgres) to optimize these patterns. Describe trade-offs in index count and write cost.
EasyTechnical
23 practiced
Consider this query against large tables:
SELECT * FROM orders o JOIN order_items oi ON o.id = oi.order_id WHERE o.user_id = 123 ORDER BY o.placed_at DESC;
Describe simple, practical optimizations: rewrite to return only needed columns, appropriate indexes (exact columns and order), and how to make the ORDER BY efficient for pagination.
EasyTechnical
39 practiced
You must choose between a relational database, a document store, and a key-value store for two different systems: (A) a user profile store where fields change frequently and different users have different attributes; (B) a financial ledger tracking account balances and transactions. For each system, choose the best storage type and justify your decision with respect to consistency, query patterns, schema flexibility, and index needs.
HardSystem Design
37 practiced
Explain the difference between partitioning (horizontal partitioning within a single DB instance) and sharding (splitting data across multiple DB instances). For a user data workload, describe how you'd choose a shard key, route requests, handle cross-shard joins, and manage re-sharding as traffic patterns change.
MediumTechnical
23 practiced
Demonstrate how to implement an UPSERT pattern in PostgreSQL using INSERT ... ON CONFLICT DO UPDATE. Show sample SQL that upserts into an inventory table (sku, qty, last_seen). Discuss concurrency implications, what unique index you need for the conflict target, and how to avoid race conditions during high parallelism.

Unlock Full Question Bank

Get access to hundreds of Relational Database Fundamentals and Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.