Interview Q&A / SQL & DBMS

INTERVIEW Q&A · 69 QUESTIONS

SQL & DBMS interview questions

Joins, keys, normalisation, indexes and transactions for placement and backend interviews.

  1. What is normalization? Explain 1NF, 2NF and 3NF.

    Normalization organises tables so each fact is stored once. 1NF means single values per cell, 2NF removes columns that depend on only part of a composite key, and 3NF removes columns that depend on other non-key columns.

    IntermediateIn-depth2 min read
  2. What are insertion, update and deletion anomalies?

    They are problems in a badly designed table where redundant data forces you to add dummy values, edit many rows for one change, or lose unrelated facts when deleting a row. Normalization removes them.

    BeginnerQuick answer1 min read
  3. What does a table need to be in First Normal Form, and what breaks it?

    A table is in 1NF when every column holds a single atomic value, there are no repeating groups, and each row is unique. Storing a comma-separated list of values in one cell breaks 1NF.

    BeginnerQuick answer1 min read
  4. What is a functional dependency in DBMS?

    A functional dependency X -> Y means that if two rows have the same X value they must have the same Y value, so X determines Y. Normalization is built on finding and organizing these dependencies.

    BeginnerQuick answer1 min read
  5. What is a partial dependency and how does 2NF remove it?

    A partial dependency is when a non-key column depends on only part of a composite primary key. 2NF requires 1NF plus no partial dependencies, which you achieve by moving that column to a table keyed by that part.

    IntermediateQuick answer1 min read
  6. What is denormalization and when would you use it?

    Denormalization deliberately adds redundant data, such as copied columns or precomputed totals, to avoid joins and speed up reads. It trades storage and write complexity for read performance, and suits read-heavy reporting.

    IntermediateQuick answer1 min read
  7. What is BCNF and how is it stricter than 3NF?

    A table is in BCNF if, for every non-trivial dependency X -> Y, X is a superkey. 3NF also lets Y be a prime attribute, which BCNF does not allow, so BCNF removes a few anomalies that 3NF misses.

    AdvancedQuick answer1 min read