SQLDbmsbeginner

DBMS Interview Questions and Answers

24 DBMS interview questions with simple examples, tested SQL, deeper questions for experienced people and 10 MCQs.

Published
TL;DR – Quick Answer

DBMS interviews focus on keys, relationships, normalization, transactions, locks and indexes. Freshers should explain each idea with a student or order table. Experienced people should also explain deadlocks, isolation levels, slow queries and safe database changes.

On This Page

DBMS interview questions test how data is stored, connected, protected and found. Freshers usually get keys, normal forms, transactions and joins. Experienced people also get locks, slow queries and recovery. This page has 24 questions with spoken answers, plus 10 MCQs.

How to answer DBMS interview questions

Give a definition, then use one small table as proof. A student, course and enrolment example works for most topics. This page explains database ideas. For query-writing practice, use the SQL fresher questions.

Topic Be ready to explain
Design Keys, relationships, normal forms
Safety Constraints, transactions, ACID
Many users Isolation, locks, deadlocks
Speed Indexes and query plans

DBMS interview questions for freshers: the basics

Q1. What is a DBMS?

30-second answer: A DBMS is software that stores, finds, changes and protects data. It also handles many users and recovery after a crash. MySQL, PostgreSQL and MongoDB are examples.

The database is the stored data. The DBMS is the software that manages it.

Q2. How is a DBMS different from a file system?

30-second answer: Files store data, but your program must handle most rules itself. A DBMS gives you queries, data rules, user permissions, transactions and recovery.

Suppose two clerks update one CSV file. One may overwrite the other. A DBMS has tools to control such changes.

Q3. What is the difference between DBMS and RDBMS?

30-second answer: DBMS is the wider term. An RDBMS stores data as tables with rows and columns, and supports relationships through keys. MySQL is an RDBMS, and MongoDB is a document database.

The SQL vs NoSQL comparison helps with the next question: which would you choose?

Q4. What are schema and instance?

30-second answer: A schema is the design of the database, such as table names and columns. An instance is the data inside it at one moment.

The schema changes rarely. The instance may change every second.

Q5. What is data independence?

30-second answer: It means you can change one level without changing the level above it. Physical independence lets you change storage or indexes without changing table design. Logical independence protects user views from some table changes.

Adding an index is a simple physical example. Your SELECT statement can stay the same.

Q6. What is an ER model?

30-second answer: An entity-relationship model shows things, their details and how they connect. Student and Course can be entities. Enrols connects them.

One student can take many courses, and one course can have many students. In tables, this many-to-many link needs an Enrolment table.

Keys, relationships and design

Q7. Explain super, candidate, primary and alternate keys.

30-second answer: A super key identifies a row and may have extra columns. A candidate key has no extra columns. The primary key is the candidate key you choose, and the others are alternate keys.

In Student, roll_no and email may each identify one row. Choose roll_no as primary, and email becomes alternate.

Q8. What is a foreign key?

30-second answer: A foreign key is a column that refers to a key in another table, or the same table. It stops links to rows that do not exist, unless the value is allowed to be NULL.

CREATE TABLE dept (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE emp (
  id INTEGER PRIMARY KEY,
  dept_id INTEGER REFERENCES dept(id)
);

An employee cannot point to missing department 99 when foreign key checks are on. SQLite needs PRAGMA foreign_keys = ON unless your library already enables it.

Q9. What is the difference between primary and unique keys?

30-second answer: A table has at most one primary key, and primary key values should not be NULL. A table can have several unique rules. Whether many NULLs are allowed in a unique column depends on the database.

Say which database you mean. PostgreSQL normally allows several NULLs, while SQL Server's unique constraint allows one.

Q10. What is normalization?

30-second answer: Normalization splits tables so each fact is stored in the right place. It reduces repeated data and update mistakes. 1NF, 2NF, 3NF and BCNF are common steps.

Form Simple check
1NF One value per cell, no repeating groups
2NF No detail depends on only part of a candidate key
3NF A non-key detail does not depend on another non-key detail
BCNF The left side of every meaningful dependency is a super key

Work through a full table in normalization questions.

Q11. What problems does normalization prevent?

30-second answer: It helps prevent insert, update and delete problems. You should not need fake data to insert a fact. One change should not need many row edits, and one delete should not lose another fact.

If instructor phone is stored in every enrolment, a phone change needs many edits. Store it once in Instructor.

Q12. What is denormalization?

30-second answer: Denormalization stores some repeated data on purpose to make certain reads simpler or faster. The cost is extra storage and more work to keep copies correct.

Measure the slow query first. An index or better query may solve it without repeated data.

Q13. What is functional dependency?

30-second answer: A functional dependency means one value decides another. If each roll number has one student name, we write roll_no -> name.

Names do not decide roll numbers, because two students can share a name. This idea is the base of normal forms.

Transactions and shared data

Q14. What is a transaction?

30-second answer: A transaction is a group of database changes treated as one job. Commit keeps it. Rollback cancels it.

BEGIN;
UPDATE account SET balance = balance - 500 WHERE id = 1;
UPDATE account SET balance = balance + 500 WHERE id = 2;
COMMIT;

If one update fails, the application must roll back. A real transfer must also check that the first account has enough money.

Q15. What is ACID?

30-second answer: Atomicity means all or nothing. Consistency means data rules stay true. Isolation controls how running transactions affect each other, and durability means committed data survives a crash.

Link each word to a money transfer. The SQL transactions guide gives more practice.

Interview note: ACID consistency is not the same as consistency in CAP. CAP talks about what copies of data in a distributed system return.

Q16. What are dirty, non-repeatable and phantom reads?

30-second answer: A dirty read sees data not yet committed. A non-repeatable read sees the same row changed later in one transaction. A phantom read finds that matching rows were added or removed.

Standard level Dirty Non-repeatable Phantom
Read uncommitted Possible Possible Possible
Read committed No Possible Possible
Repeatable read No No Possible
Serializable No No No

This table gives the SQL standard's minimum rules. Real databases can give stronger protection.

Q17. What is a deadlock?

30-second answer: A deadlock happens when jobs wait for each other in a circle. Job A holds row 1 and needs row 2. Job B holds row 2 and needs row 1.

Many databases detect it and cancel one job. Update rows in the same order, keep transactions short, and safely retry the cancelled job.

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

30-second answer: A shared lock usually allows other readers. An exclusive lock protects a change from conflicting locks. Exact rules differ between databases.

Common mistake: Saying readers always block writers. Many databases use MVCC, which keeps row versions so normal reads and writes can often run together.

Speed and experienced-level questions

Q19. What is an index?

30-second answer: An index is an extra data structure that helps find rows without checking the whole table. It speeds up suitable reads, but uses space and makes writes do more work.

For an index on (city, age), a search by city can usually use the first part well. A search by age alone often cannot. See SQL index questions.

Q20. Clustered or non-clustered index?

30-second answer: In a clustered index, table rows are organized by the index key. A non-clustered index is separate and points to rows. The exact design depends on the database.

MySQL InnoDB stores the table by its primary key when one exists. PostgreSQL uses a heap, so its CLUSTER command does not keep future rows in that order.

Q21. A query has become slow. What do you check?

30-second answer: I check what changed, read the query plan, and compare expected rows with real rows. Then I check indexes, joins, locks and returned columns. I test on data that has a similar size and spread.

EXPLAIN ANALYZE runs the query in PostgreSQL. Be careful with updates and deletes.

Q22. What is write-ahead logging?

30-second answer: The database saves a log record before it saves the changed data page. After a crash, it can use the log to restore committed work.

This supports durability. A log is not a full replacement for tested backups.

Q23. How do you change a live table safely?

30-second answer: I add changes in small steps that old and new code can both use. I fill old rows in batches, check the result, switch the code, and remove the old column later.

Always check lock time and have a way back. A command that is quick on ten rows may block a large live table.

Q24. Replication or sharding?

30-second answer: Replication keeps copies of data on more servers. Sharding puts different parts of the data on different servers. Copies help reads and recovery, while shards help when one server cannot hold the data or write load.

Replicas may lag behind. Shards make joins and transactions across parts harder.

Pro tip: For experienced roles, explain one real query plan or data change. Give the problem, your check and the result.

DBMS interview questions MCQ practice

Answer these before you read the key.

  1. Which key is chosen to identify table rows? A) Foreign B) Primary C) Super D) Index
  2. Which ACID part means all or nothing? A) Atomicity B) Isolation C) Durability D) Consistency
  3. A many-to-many link normally needs? A) A trigger B) A view C) A cursor D) A junction table
  4. Which read sees uncommitted data? A) Phantom B) Dirty C) Repeatable D) Serial
  5. 1NF requires? A) No joins B) An index C) One value per cell D) No NULL
  6. Which command makes a transaction permanent? A) ROLLBACK B) COMMIT C) GRANT D) SELECT
  7. Which rule links one table to another? A) CHECK B) DEFAULT C) NOT NULL D) FOREIGN KEY
  8. A minimal super key is a? A) Candidate key B) Foreign key C) View D) Log
  9. An index mainly helps? A) Every write B) Suitable searches C) All joins equally D) Backups
  10. A circular wait for locks is? A) Commit B) View C) Deadlock D) Normal form

Answer key: 1 B, 2 A, 3 D, 4 B, 5 C, 6 B, 7 D, 8 A, 9 B, 10 C.

How to prepare for the interview

Draw a small library database with Book, Member and Loan. Mark every key, write five queries, and explain one transaction. Next, put repeated author data into one table and normalize it step by step.

Spend one day on design, one on transactions, one on indexes and one on queries. These DBMS interview questions and answers for freshers become easier when one example covers many answers. Finish the written DBMS interview questions MCQ set last. The Java full stack course includes the wider path for students who want structured application practice.

When you revise these DBMS interview questions and answers, draw first and speak second. A two-table drawing often explains a key or a join faster than a long definition.

Frequently Asked Questions

Is DBMS the same as SQL?
No. A DBMS is software that stores and manages data. SQL is the language used to work with most relational database systems.
Which DBMS topics matter most for freshers?
Start with keys, relationships, normal forms up to BCNF, ACID, joins and indexes. Be able to draw two related tables and explain why you split them.
Are DBMS MCQs asked in placements?
They may appear in written screening tests. Practise them after you understand the ideas, because small wording changes can change the answer.
Should I learn MySQL or PostgreSQL for a DBMS interview?
Either is fine for learning the main ideas. Use the database named in the job description when there is one. Always say which database you mean when its rules differ.
How is this different from SQL interview preparation?
DBMS preparation explains how data is designed, protected and stored. SQL preparation is mainly query writing. Most technical candidates need both.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 3 December 2026 LinkedIn
Chat with us