Interview Q&A / SQL & DBMS
SQL & DBMS interview questions
Joins, keys, normalisation, indexes and transactions for placement and backend interviews.
Prefer rapid revision? Practise SQL & DBMS short interview answers →
- What is the difference between a primary key, a unique key and a foreign key?
A primary key uniquely identifies each row and cannot be NULL; a table has only one. A unique key also prevents duplicates, but a table can have many and they usually allow NULL. A foreign key is a column that must match a primary or unique key in another table, which keeps related data consistent.
BeginnerIn-depth3 min read - 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 - What is the difference between a clustered and a non-clustered index?
A clustered index decides the physical order in which table rows are stored, so the table itself is the index and there can be only one. A non-clustered index is a separate structure holding the indexed values plus a pointer back to the row, and a table can have many.
AdvancedIn-depth4 min read