DBMS Interview Questions and Answers: 46 Questions for Freshers

Quick answer: These 46 DBMS interview questions and answers cover what is asked most in software engineer, database developer and data analyst interviews: DBMS basics, ER models, keys and constraints, normalization, transactions and concurrency, indexing and recovery, and SQL versus NoSQL. Each answer is short and exam-friendly, so you can revise quickly.

Read each answer, then close the page and explain it aloud in two or three sentences. That is exactly what interviewers check.

Contents

1. DBMS Basics Interview Questions

Q1. What is a DBMS?

A Database Management System is software that stores, organises and manages data, and lets users create, read, update and delete it safely. Examples are MySQL, PostgreSQL, Oracle and SQL Server.

Q2. What are the advantages of a DBMS over a file system?

A DBMS reduces data redundancy and inconsistency, supports concurrent access, enforces integrity constraints, provides security and access control, supports backup and recovery, and offers a query language such as SQL.

Q3. What is the difference between DBMS and RDBMS?

A DBMS stores data in any form, such as files or hierarchies. An RDBMS stores data in related tables with keys, supports SQL, enforces relationships with foreign keys and supports ACID transactions.

Q4. What is the three-schema architecture?

It separates the internal level (how data is physically stored), the conceptual level (the logical structure of the whole database) and the external level (individual user views). This provides data independence.

Q5. What is data independence?

Physical data independence means the storage structure can change without changing the logical schema. Logical data independence means the logical schema can change without changing user views or applications.

Q6. What are the types of database languages?

DDL (CREATE, ALTER, DROP) defines structure, DML (INSERT, UPDATE, DELETE, SELECT) manipulates data, DCL (GRANT, REVOKE) controls access and TCL (COMMIT, ROLLBACK) manages transactions.

2. Data Models and ER Diagrams Interview Questions

Q7. What is a data model?

A data model describes how data is structured and related. Types include hierarchical, network, relational, entity-relationship, object-oriented and document models.

Q8. What is an ER diagram?

An Entity-Relationship diagram shows entities (rectangles), attributes (ovals) and relationships (diamonds) between entities. It is used to design a database before creating tables.

Q9. What are the types of attributes?

Simple and composite (name split into first and last), single-valued and multi-valued (phone numbers), stored and derived (age derived from date of birth), and key attributes.

Q10. What is a weak entity?

A weak entity cannot be identified by its own attributes alone and depends on a strong entity. For example, a Dependent depends on an Employee. It is shown with a double rectangle.

Q11. What are cardinality ratios?

One-to-one, one-to-many, many-to-one and many-to-many. For example, one department has many employees (one-to-many), and students enrol in many courses while courses have many students (many-to-many).

Q12. How is a many-to-many relationship converted into tables?

Create a separate junction table containing the primary keys of both entities as foreign keys, such as an Enrolment table with student_id and course_id.

Q13. What are generalisation and specialisation?

Generalisation combines common features of several entities into a higher-level entity, such as Car and Bike into Vehicle. Specialisation splits an entity into sub-entities, such as Employee into Engineer and Manager.

3. Keys and Constraints Interview Questions

Q14. What are the different types of keys?

Super key (any set of attributes that uniquely identifies a row), candidate key (a minimal super key), primary key (the chosen candidate key), alternate key (other candidate keys), foreign key (refers to a primary key in another table) and composite key (made of more than one column).

Q15. What is the difference between a primary key and a unique key?

A table has only one primary key and it cannot contain NULL. It can have several unique keys, and a unique column usually allows NULL.

Q16. What is a foreign key?

A foreign key is a column that refers to the primary key of another table. It enforces referential integrity, so a child row cannot point to a parent that does not exist.

Q17. What are integrity constraints?

Rules that keep data valid: domain constraints (valid data type and range), entity integrity (primary key not NULL), referential integrity (valid foreign keys), and constraints such as NOT NULL, UNIQUE, CHECK and DEFAULT.

Preparing for a DBMS interview? We run live one-to-one classes and mock interviews in DBMS, SQL and core computer science subjects, arranged around your free time. Chat on WhatsApp.

4. Normalization Interview Questions

Q18. What is normalization?

Normalization organises tables to reduce redundancy and avoid insertion, update and deletion anomalies, by splitting data into well-structured related tables.

Q19. What are insertion, update and deletion anomalies?

Insertion anomaly: cannot add data without unrelated data, such as a new course without a student. Update anomaly: the same data must be changed in many rows. Deletion anomaly: deleting one fact removes other useful facts.

Q20. What is a functional dependency?

A functional dependency X → Y means the value of X determines the value of Y. For example, student_id → student_name.

Q21. Explain 1NF, 2NF, 3NF and BCNF.

1NF: all values are atomic, with no repeating groups. 2NF: in 1NF and no partial dependency of a non-key attribute on part of a composite key. 3NF: in 2NF and no transitive dependency of a non-key attribute on another non-key attribute. BCNF: for every functional dependency X → Y, X is a super key.

Q22. What is the difference between 3NF and BCNF?

3NF allows a dependency X → Y when Y is part of a candidate key (a prime attribute), even if X is not a super key. BCNF does not allow this exception, so it is stricter.

Q23. What are 4NF and 5NF?

4NF removes multi-valued dependencies, and 5NF removes join dependencies. They are rarely needed in normal business databases.

Q24. What is denormalization?

Denormalization deliberately adds redundancy to improve read performance, by reducing joins in reporting and read-heavy systems, at the cost of extra storage and update complexity.

Q25. What is a lossless join decomposition?

A decomposition is lossless if joining the decomposed tables gives back exactly the original table, without extra or missing rows. It is required when normalizing.

5. Transactions and Concurrency Interview Questions

Q26. What is a transaction?

A transaction is a sequence of operations performed as a single logical unit of work, such as transferring money: debit one account and credit another. It must either complete fully or not at all.

Q27. What are the ACID properties?

Atomicity (all or nothing), Consistency (the database moves from one valid state to another), Isolation (concurrent transactions do not interfere) and Durability (committed changes survive failures).

Q28. What are the states of a transaction?

Active, Partially Committed, Committed, Failed and Aborted.

Q29. What problems occur with concurrent transactions?

Lost update, dirty read (reading uncommitted data), non-repeatable read (different values when reading the same row twice) and phantom read (new rows appearing in a repeated query).

Q30. What is serializability?

A schedule of concurrent transactions is serializable if its result is the same as some serial (one-after-another) execution. Conflict serializability is checked with a precedence graph: the schedule is conflict serializable if the graph has no cycle.

Q31. What is two-phase locking (2PL)?

In 2PL, a transaction acquires all its locks in a growing phase and releases them in a shrinking phase, never acquiring a lock after releasing one. It guarantees conflict serializability but can cause deadlocks.

Q32. What is the difference between shared and exclusive locks?

A shared (read) lock allows many transactions to read the data at the same time. An exclusive (write) lock allows only one transaction to read and write, and blocks all others.

Q33. What are isolation levels?

Read Uncommitted, Read Committed, Repeatable Read and Serializable. Higher levels prevent more concurrency problems but reduce performance.

Q34. What is a deadlock in DBMS and how is it handled?

A deadlock occurs when transactions wait for each other's locks in a cycle. DBMSs detect it with a wait-for graph and abort one transaction, or prevent it with timeouts and lock-ordering schemes such as wait-die and wound-wait.

6. Indexing, Storage and Recovery Interview Questions

Q35. What is indexing?

An index is a data structure that speeds up data retrieval by avoiding a full table scan, at the cost of extra storage and slower inserts and updates.

Q36. What is the difference between clustered and non-clustered indexes?

A clustered index decides the physical order of data rows, so there is only one per table. A non-clustered index is a separate structure that points to the rows, and a table can have several.

Q37. Why are B+ trees used for indexing?

B+ trees are balanced, keep all data pointers at the leaf level, store many keys per node to reduce disk reads, and link leaves together, which makes both point lookups and range queries efficient.

Q38. What is hashing in DBMS?

Hashing uses a hash function to map a key to a bucket address, giving fast equality lookups. It is not suitable for range queries.

Q39. What is database recovery?

Recovery restores the database to a consistent state after a failure, using logs, checkpoints and backups. Committed transactions are redone and uncommitted ones are undone.

Q40. What is write-ahead logging?

In write-ahead logging, changes are written to the log on stable storage before they are written to the database, so the system can recover by redoing or undoing operations after a crash.

Q41. What is a checkpoint?

A checkpoint records a point where all changes up to that time are saved to disk, so recovery only needs to process the log after the last checkpoint.

7. SQL and Modern Databases Interview Questions

Q42. What is the difference between DELETE, TRUNCATE and DROP?

DELETE removes selected rows and can be rolled back in a transaction. TRUNCATE removes all rows quickly and keeps the table structure. DROP removes the whole table and its structure.

Q43. What is a view?

A view is a virtual table defined by a query. It simplifies complex queries and restricts what data users can see.

Q44. What are joins? Name the types.

Joins combine rows from tables using related columns: INNER, LEFT, RIGHT, FULL OUTER, CROSS and SELF joins.

Q45. What is the difference between SQL and NoSQL databases?

SQL databases are relational, use a fixed schema and support complex joins and ACID transactions. NoSQL databases (document, key-value, column-family and graph) have flexible schemas and scale horizontally, which suits large or rapidly changing data.

Q46. What is the CAP theorem?

In a distributed database, during a network partition you must choose between consistency (every read gets the latest write) and availability (every request gets a response). Partition tolerance is required in distributed systems.

How to Prepare for a DBMS Interview

  1. Master normalization: find candidate keys and decompose into 3NF and BCNF.
  2. Explain ACID with a bank transfer: it is the classic example.
  3. Know the key types: super, candidate, primary, foreign and composite.
  4. Understand indexing: clustered versus non-clustered and why B+ trees are used.
  5. Pair theory with SQL: practise queries alongside the concepts.

Next steps: practise SQL interview questions and SQL query interview questions, and see all subjects on our interview questions page.

Want a mentor for your preparation? We teach DBMS, SQL and core computer science subjects through live online classes arranged around your free time, with mock interviews before your placement. Message us on WhatsApp or email engineersrworld@gmail.com.

More interview preparation: see all interview questions, including Python, SQL, SQL query, Java, JavaScript, React, C++, .NET, Spring Boot, Node.js, DSA, OOPs, DBMS, operating system, networking, machine learning, data science, AI, Excel, Power BI, DevOps, manual testing, Selenium, cyber security and HR.

Frequently Asked Questions

Which DBMS topics are asked most in interviews?

Keys, normalization (1NF to BCNF), ACID properties, joins, transactions and concurrency, indexing, and SQL versus NoSQL come up in almost every interview.

Is DBMS the same as SQL?

No. DBMS is the theory and software that manage databases, while SQL is the language used to query relational databases. Interviews test both.

Do I need to solve normalization problems in interviews?

Often yes. Practise finding candidate keys from functional dependencies and decomposing tables into 3NF and BCNF.

How should I prepare for DBMS interview questions?

Revise the theory on this page, practise SQL queries daily, and design a small database such as a library or college system with an ER diagram and normalized tables.

Scroll to Top