DBMS Interview Questions and Answers
Core database management system concepts explained for interviews and vivas: keys, normalization, ACID properties, indexing and transactions, with concise answers.
QuizMaster TeamSeptember 28, 20269 min read
Database Management Systems (DBMS) questions show up in college exams, vivas and technical interviews because almost every application depends on one. This guide covers the concepts examiners ask about most, with answers you can actually explain rather than recite.
Fundamentals
- What is a DBMS? Software that lets you create, store, query, update and manage data in an organised way, while handling concerns like consistency, security and concurrent access on your behalf.
- What is the difference between DBMS and RDBMS? A DBMS manages data generally; an RDBMS (Relational DBMS) specifically organises data into tables with rows and columns and enforces relationships between them using keys, following the relational model.
- What is a schema? The overall structure of a database: its tables, columns, data types and the relationships between them.
- What is the difference between a database and a table? A database is a collection of related data, typically containing many tables; a table is a single structured set of rows and columns within it.
Keys
- What is a primary key? A column (or set of columns) that uniquely identifies each row in a table. It cannot contain NULL and must be unique.
- What is a foreign key? A column in one table that references the primary key of another table, used to enforce a relationship between the two.
- What is a candidate key? Any column or set of columns that could qualify as the primary key (unique and not null); one candidate key is chosen as the actual primary key.
- What is a composite key? A primary key made up of two or more columns together, used when no single column is unique on its own.
Normalization
- What is normalization? The process of organising tables to reduce data redundancy and avoid update anomalies, by splitting data into smaller related tables.
- What is 1NF (First Normal Form)? Each column holds a single, atomic value, and each row is unique; no repeating groups or multi-valued fields.
- What is 2NF? The table is in 1NF, and every non-key column depends on the whole primary key, not just part of it (relevant for composite keys).
- What is 3NF? The table is in 2NF, and no non-key column depends on another non-key column (no transitive dependency).
- Why would you denormalize a database? To improve read performance for specific queries by reducing the number of joins needed, at the cost of some redundancy and more complex updates.
ACID properties and transactions
- What does ACID stand for? Atomicity, Consistency, Isolation and Durability: the four properties that guarantee a database transaction is processed reliably.
- What is atomicity? A transaction either completes entirely or has no effect at all; there is no partially applied state.
- What is isolation? Concurrent transactions do not interfere with each other; each behaves as if it were the only transaction running.
- What is a transaction? A sequence of one or more database operations that are executed as a single logical unit of work.
- What is a deadlock? A situation where two or more transactions are each waiting for a resource the other holds, so none can proceed.
Indexes and performance
- What is an index? A data structure that lets the database find rows faster, without scanning the entire table, at the cost of extra storage and slightly slower writes.
- When should you avoid adding an index? On columns that are rarely queried or filtered on, or on small tables where a full scan is already fast, since every index adds write overhead.
- What is a query execution plan? The sequence of steps the database engine will take to run a query, which can be inspected (commonly with
EXPLAIN) to see whether indexes are being used.
SQL vs NoSQL
- What is the main difference between SQL and NoSQL databases? SQL (relational) databases store data in fixed-schema tables and enforce relationships with keys; NoSQL databases, such as document stores, store more flexible, often schema-less data and are commonly chosen for horizontal scalability or rapidly changing data shapes.
- When might you choose a document database over a relational one? When your data doesn't fit neatly into tables, changes shape often, or when you want to keep related data in one place to avoid joins, as covered in the MongoDB Basics quiz.
How to prepare
- Be able to define ACID, normalization and keys without notes, each with a one-sentence example.
- Practise writing a simple ER diagram on paper: entities, relationships and keys.
- Test your query-writing with the SQL Basics quiz and the Joins & Aggregation quiz.
- If asked to design a schema on the spot, start by listing entities, then their attributes, then the relationships between them.
Key takeaways
- Know the difference between DBMS and RDBMS, and the purpose of primary and foreign keys.
- Be able to explain 1NF, 2NF and 3NF with a short example of the problem each one fixes.
- ACID properties (atomicity, consistency, isolation, durability) are a near-certain interview question.
- Indexes speed up reads and slow down writes; add them deliberately, not everywhere.