DBMS Concepts

Cover keys, ER models, normalisation, transactions and ACID, concurrency control and indexing at interview depth.

Intermediate · about 8 hours · difficulty 3/5

Learn first: How Campus and Off-Campus Hiring Works

DBMS questions appear in nearly every technical interview for freshers. Interviewers want clear definitions plus one example each.

Core concepts

  • Keys: super, candidate, primary, alternate, foreign and composite keys.
  • ER model: entities, attributes, relationships, cardinality (1:1, 1:N, M:N) and converting ER diagrams to tables.
  • Normalisation: 1NF, 2NF, 3NF and BCNF, with functional dependencies; explain the anomalies (insert, update, delete) each one removes. Know when denormalisation helps reads.
  • Transactions and ACID: atomicity, consistency, isolation, durability with a bank transfer example.
  • Concurrency: dirty read, non-repeatable read, phantom read; isolation levels; locking and two-phase locking; deadlocks in databases.
  • Indexing: why B+ trees, clustered vs non-clustered indexes, when an index is not used.
  • SQL vs NoSQL at a high level, and the CAP theorem in one paragraph.

Pitfalls

  • Defining 2NF and 3NF without a concrete example table.
  • Saying "indexes make everything faster" without mentioning write cost and storage.

You are ready to move on when you can normalise a messy student-course table to 3NF on a whiteboard and explain ACID with a money transfer.

Key concepts

  • Types of keys
  • ER model to tables
  • Functional dependencies
  • Normal forms: 1NF to BCNF
  • Transactions and ACID
  • Isolation levels and anomalies
  • Indexing and B+ trees
  • SQL vs NoSQL and CAP

Mini project

Design a college placement database (students, companies, drives, applications, offers): draw the ER diagram, convert it to tables in 3NF, mark all keys, and write a one-page note on which columns you would index and why.

Check yourself

Explain a non-repeatable read with a two-transaction example, and which isolation level prevents it.

Free resources