Database Interview Questions
Test your knowledge of relational and NoSQL databases. Practice questions on SQL, indexing, normalization, transactions, and database design.
Frequently Asked Questions
Should I learn SQL or NoSQL for interviews?
Both. SQL databases (PostgreSQL, MySQL) are essential for understanding relational data, joins, and ACID transactions. NoSQL databases (DynamoDB, MongoDB, Redis) are important for system design questions involving scale, caching, and flexible schemas.
What database concepts are tested in interviews?
Common topics include SQL queries and joins, indexing strategies (B-tree, hash), normalization forms, ACID properties, transaction isolation levels, database sharding, replication, and choosing between SQL vs NoSQL for different use cases.
What is database indexing and why does it matter?
Indexes are data structures (usually B-trees) that speed up queries by avoiding full table scans. They trade write performance and storage for faster reads. Knowing when to add indexes, composite indexes, and covering indexes is a common interview topic.
What are the ACID properties?
ACID stands for Atomicity (transactions are all-or-nothing), Consistency (data stays valid), Isolation (concurrent transactions don't interfere), and Durability (committed data survives crashes). Understanding ACID is fundamental for database interview questions.
How does database sharding work?
Sharding splits data across multiple database instances based on a shard key (e.g., user ID). It enables horizontal scaling but introduces complexity around cross-shard queries, rebalancing, and maintaining consistency. This is a frequent system design interview topic.
What is the difference between horizontal and vertical scaling for databases?
Vertical scaling (scaling up) adds more CPU/RAM to a single server. Horizontal scaling (scaling out) adds more servers. Vertical has limits and a single point of failure. Horizontal is more complex but offers better fault tolerance and capacity. Most large-scale systems use horizontal scaling.