CS Fundamentals · Fresher-relevant
DBMS interview questions on normalisation, ACID properties, transactions, ER diagrams, and indexing — a must-prepare subject for campus placement.
What is normalisation? Explain 1NF, 2NF, and 3NF.
Tip: 1NF: atomic values, no repeating groups. 2NF: 1NF + no partial dependency on part of a composite key. 3NF: 2NF + no transitive dependency (non-key attributes depend only on the key). Goal: remove redundancy and update/insert/delete anomalies.
What is the difference between a primary key, candidate key, and foreign key?
Tip: A candidate key uniquely identifies a row; the chosen one is the primary key (unique, not null). Other candidates are alternate keys. A foreign key references another table's primary key to enforce referential integrity.
Explain ACID properties.
Tip: Atomicity: a transaction is all-or-nothing. Consistency: it moves the DB between valid states honouring constraints. Isolation: concurrent transactions do not interfere. Durability: committed changes survive failures. These guarantee reliable transactional processing.
What are isolation levels and the anomalies they prevent?
Tip: Read Uncommitted allows dirty reads; Read Committed prevents dirty reads; Repeatable Read prevents non-repeatable reads; Serializable prevents phantom reads (full isolation). Higher isolation reduces concurrency — choose the lowest level that prevents the anomalies your app cares about.
What is the difference between clustered and non-clustered indexes?
Tip: A clustered index defines the physical row order (one per table — often the primary key); the leaf level IS the data. A non-clustered index is a separate structure pointing back to rows, so multiple can exist. Clustered scans are great for range queries on the key.
What is a deadlock in a database and how is it handled?
Tip: A deadlock occurs when two transactions each hold a lock the other needs, waiting forever. DBMSs detect cycles in the wait-for graph and abort a victim transaction (to be retried). Prevent by acquiring locks in a consistent order and keeping transactions short.
What is the difference between DELETE, TRUNCATE, and DROP?
Tip: DELETE removes rows (optionally with WHERE), is logged row-by-row, and can be rolled back. TRUNCATE removes all rows quickly with minimal logging and resets identity, but can't use WHERE. DROP removes the table structure entirely.
What is the difference between SQL and NoSQL databases?
Tip: SQL databases are relational with fixed schemas, strong ACID guarantees, and powerful joins — ideal for structured, transactional data. NoSQL (document, key-value, column, graph) offers flexible schemas and horizontal scalability with eventual consistency — ideal for large-scale, varied, or rapidly-evolving data.
InterviewEra generates role-specific questions using your actual projects and skills. Get scored feedback on technical depth, clarity, and structure — free to start.