If you are preparing for campus placements or off-campus hiring drives in 2027, practicing dbms interview questions for freshers is non-negotiable. Almost every technical round at Infosys, TCS, Capgemini, Accenture, and product startups pairs hands-on query writing with database fundamentals. Alongside solving our SQL Interview Questions for Freshers 2027 guide, you must be able to explain why tables are normalized, how transactions prevent double-spending, and why an index speeds up lookups.
This curated bank of 35 DBMS interview questions for freshers covers architecture, keys, normalization, ACID properties, concurrency, indexing, query performance, and real-world schema scenarios.
Core DBMS & Architecture Interview Questions for Freshers (Q1–Q8)
1. What is a DBMS, and how does it differ from a file system?
A Database Management System (DBMS) is software that defines, stores, retrieves, and manages structured data while enforcing security, concurrency, and integrity rules. Unlike flat file systems—which suffer from data redundancy, inconsistency, and lack of concurrent access control—a DBMS centralizes metadata, enforces constraints (like UNIQUE and FOREIGN KEY), and supports atomic multi-user transactions.
2. What is the difference between DBMS and RDBMS?
A traditional DBMS may store data in hierarchical, network, or file-based structures without enforcing strict tabular relationships. An RDBMS (Relational DBMS, such as MySQL, PostgreSQL, or Oracle) stores data in normalized tables (relations) with rows and columns, enforces Codd’s rules, and links tables using primary and foreign keys.
3. Explain Schema vs. Instance in DBMS.
A schema is the logical blueprint of the database—table names, column names, data types, and constraints—which rarely changes. An instance is the actual snapshot of data stored in the database at a specific moment, which changes continuously with every INSERT, UPDATE, or DELETE.
4. What is Data Independence (Logical vs. Physical)?
- Physical Data Independence: Ability to change physical storage (e.g., switching from HDD to SSD, adding B-Tree indexes, or changing file organization) without modifying the logical schema or application queries.
- Logical Data Independence: Ability to alter the logical schema (e.g., adding a column or splitting a table) without breaking external views or existing application code.
5. What is the 3-Schema (Three-Level) Architecture of DBMS?
Proposed by ANSI/SPARC, it separates a database into three layers: the External Level (user-specific views hiding sensitive columns), the Conceptual/Logical Level (full database structure and relationships), and the Internal/Physical Level (low-level storage blocks, compression, and indexes).
6. What are Super Key, Candidate Key, Primary Key, and Foreign Key?
Interviewers frequently test key definitions with trick follow-ups about NULL values and minimality. Use this quick reference table to keep them clear:
| Key Type | Definition | Uniqueness & NULL Rule | Example (Students Table) |
|---|---|---|---|
| Super Key | Any set of one or more attributes that uniquely identifies a row | Unique; may contain extra redundant attributes | (student_id, email) |
| Candidate Key | Minimal super key with no unnecessary attributes | Unique; minimal; candidate for PK | student_id or email |
| Primary Key | The chosen candidate key used to identify rows | Strictly unique and NOT NULL |
student_id |
| Alternate Key | Remaining candidate keys not picked as Primary Key | Unique; can be UNIQUE constrained |
email |
| Composite Key | A primary or candidate key made of two or more columns | Combination is unique | (student_id, course_id) |
| Foreign Key | Column referencing a Primary/Unique key in another table | Can repeat and accept NULL |
dept_id referencing Departments(id) |
7. Can a table have multiple Primary Keys or multiple Foreign Keys?
A table can have only one Primary Key (though it can be a composite key spanning multiple columns). However, a table can have multiple Foreign Keys referencing one or more parent tables.
8. What is Referential Integrity?
Referential integrity guarantees that a foreign key value must either match an existing primary key value in the referenced parent table or be NULL. It prevents orphan records when parent rows are updated or deleted, controlled via ON DELETE CASCADE, ON DELETE SET NULL, or RESTRICT.
Normalization & Denormalization (Q9–Q15)
9. What is Normalization, and why do we need it?
Normalization is the systematic process of decomposing large tables into smaller, well-structured tables to eliminate data redundancy and prevent insertion, update, and deletion anomalies.
10. Explain 1NF, 2NF, 3NF, and BCNF with examples.
| Normal Form | Rule | Eliminates | Concrete Example |
|---|---|---|---|
| 1NF | All columns hold atomic (indivisible) values; no repeating groups | Multi-valued attributes | Split skills = "Java, SQL" into separate rows in a StudentSkills table |
| 2NF | Must be in 1NF + no partial dependency on part of a composite key | Partial dependencies | In (student_id, course_id) -> student_name, move student_name to Students |
| 3NF | Must be in 2NF + no transitive dependency (non-key -> non-key) | Transitive dependencies | In emp_id -> dept_id -> dept_name, move dept_name to Departments |
| BCNF | For every functional dependency X -> Y, X must be a super key |
Overlapping candidate-key anomalies | When a non-super-key attribute determines part of a candidate key, decompose further |
11. What is the difference between 3NF and BCNF?
3NF allows a dependency X -> Y even if X is not a super key, provided Y is a prime attribute (part of some candidate key). BCNF is stricter: for every non-trivial functional dependency X -> Y, X must be a super key. Every BCNF relation is in 3NF, but not every 3NF relation is in BCNF.
12. What are Insertion, Update, and Deletion Anomalies?
- Insertion Anomaly: You cannot add a new department until at least one student enrolls in it if both live in a single unnormalized table.
- Update Anomaly: Changing a department’s HOD name requires updating hundreds of student rows; missing one leaves inconsistent data.
- Deletion Anomaly: Deleting the last student in a branch accidentally wipes out the department’s metadata too.
13. What is Functional Dependency?
A functional dependency X -> Y means that knowing the value of attribute set X uniquely determines the value of attribute set Y. For example, roll_no -> student_name holds because one roll number maps to exactly one student name.
14. What is Denormalization, and when is it used?
Denormalization intentionally adds controlled redundancy—such as storing total_order_amount on an Orders table or duplicating a user’s display name in a comments feed—to avoid expensive multi-table JOINs in read-heavy analytics dashboards (OLAP) or high-traffic feeds.
15. Should you normalize every table up to 5NF in real applications?
No. Most production OLTP applications stop at 3NF or BCNF because decomposing further into 4NF/5NF creates too many small tables and slows down common queries with excessive joins.
Transactions, ACID & Concurrency Control (Q16–Q23)
16. What is a Transaction, and what are the ACID properties?
A transaction is a single logical unit of work consisting of one or more SQL operations. Consider transferring ₹5,000 from Account A to Account B:
- Atomicity (All or Nothing): Either both debit from A and credit to B succeed, or neither does (via
ROLLBACK). - Consistency: Total money across A and B before and after the transaction stays intact and obeys all constraints.
- Isolation: Concurrent transfers running at the same millisecond do not interfere with or corrupt each other’s intermediate balance.
- Durability: Once
COMMITreturns success, the new balances survive power loss or server crashes using write-ahead logs (WAL).
17. What are Dirty Read, Non-Repeatable Read, and Phantom Read?
- Dirty Read: Transaction T2 reads uncommitted changes made by T1, which T1 later rolls back.
- Non-Repeatable Read: T1 reads a row twice and sees different values because T2 updated and committed that row in between.
- Phantom Read: T1 runs a range query (e.g.,
WHERE salary > 50000) twice and sees new rows inserted by T2 on the second read.
18. Explain SQL Transaction Isolation Levels.
| Isolation Level | Dirty Read | Non-Repeatable Read | Phantom Read |
|---|---|---|---|
| READ UNCOMMITTED | Possible | Possible | Possible |
| READ COMMITTED | Prevented | Possible | Possible |
| REPEATABLE READ | Prevented | Prevented | Possible (prevented in MySQL InnoDB via gap locks) |
| SERIALIZABLE | Prevented | Prevented | Prevented |
19. What is a Deadlock in DBMS, and how is it handled?
A deadlock happens when Transaction T1 holds a lock on Row X and waits for Row Y, while T2 holds Row Y and waits for Row X. Databases handle deadlocks using Deadlock Detection (building a wait-for graph and rolling back the younger/cheaper victim transaction) or Deadlock Prevention (wait-die / wound-wait timestamp schemes and lock timeouts).
20. What is Two-Phase Locking (2PL)?
2PL guarantees conflict serializability by splitting a transaction into two phases: a Growing Phase (acquiring shared/exclusive locks without releasing any) and a Shrinking Phase (releasing locks without acquiring new ones). Strict 2PL holds all exclusive locks until COMMIT or ROLLBACK to avoid cascading aborts.
21. Shared Lock vs. Exclusive Lock—what is the difference?
A Shared Lock (S-lock) lets multiple transactions read the same row concurrently, blocking writes. An Exclusive Lock (X-lock) grants one transaction exclusive read and write access, blocking all other reads and writes until released.
22. What is Checkpointing in DBMS recovery?
A checkpoint periodically flushes modified dirty pages from memory buffers to disk and writes a marker in the transaction log. During crash recovery, the DBMS only needs to replay/undo logs from the latest checkpoint instead of scanning the entire log history.
23. What is Optimistic vs. Pessimistic Concurrency Control?
Pessimistic locking assumes conflicts are frequent and locks rows upfront (SELECT ... FOR UPDATE). Optimistic concurrency assumes conflicts are rare, lets reads proceed lock-free, and checks a version column or timestamp before committing updates.
Indexing, Joins & Query Performance (Q24–Q30)
24. What is an Index, and what is the trade-off of creating too many indexes?
An index is an auxiliary data structure (usually a B+ Tree) that speeds up SELECT, WHERE, JOIN, and ORDER BY operations without scanning every row. The trade-off is extra disk space and slower INSERT, UPDATE, and DELETE operations because every affected index must also be updated.
25. Clustered vs. Non-Clustered Index—compare them.
| Feature | Clustered Index | Non-Clustered Index |
|---|---|---|
| Physical Storage | Sorts and stores actual table rows in index order | Stored separately with pointers (row ID / PK) to actual rows |
| Count per Table | Maximum 1 per table | Can have many per table |
| Lookup Speed | Faster for range queries (data is contiguous) | Requires an extra lookup (unless covered by the index) |
26. B-Tree / B+ Tree Index vs. Hash Index: when is each better?
B+ Tree indexes store sorted keys in balanced multi-way nodes with linked leaf pages, making them ideal for both equality (=) and range queries (>, BETWEEN, LIKE 'abc%'). Hash indexes offer O(1) average lookup for exact equality (=) only and cannot accelerate range queries or sorting.
27. Compare DELETE, TRUNCATE, and DROP.
DELETE(DML): Removes specific rows usingWHERE, logs each row deletion, fires triggers, and can be rolled back.TRUNCATE(DDL): Removes all rows instantly by deallocating data pages, resets identity counters, does not fire row-level triggers, and is minimally logged.DROP(DDL): Permanently deletes the entire table structure, data, indexes, and constraints from the schema.
28. Explain WHERE vs. HAVING in SQL.
WHERE filters individual rows before grouping and cannot reference aggregate functions like COUNT() or SUM(). HAVING filters grouped buckets after GROUP BY has run. Always filter non-aggregate conditions in WHERE first to reduce the rows entering aggregation.
29. What is the difference between a View and a Materialized View?
A standard View is a saved virtual query—it stores no data itself and executes the underlying query on every access. A Materialized View caches the physical result set on disk for fast reads and refreshes on a schedule or trigger.
30. What are SQL Joins, and which join returns unmatched rows?
INNER JOIN returns only matching rows across both tables. LEFT JOIN returns all rows from the left table plus matching rows from the right (filling NULL when unmatched). RIGHT JOIN does the reverse, and FULL OUTER JOIN preserves unmatched rows from both sides.
Scenario-Based & Company DBMS Interview Questions (Q31–Q35)
31. How would you design a College Course Enrollment schema?
Notice that a student can enroll in many courses and a course has many students (many-to-many). You never store comma-separated course IDs in Students. Instead, create three tables: Students(student_id PK, name, email UNIQUE), Courses(course_id PK, title, credits), and a junction table Enrollments(student_id FK, course_id FK, enrolled_at, grade, PRIMARY KEY(student_id, course_id)).
32. A query on a 5-million-row Orders table suddenly became slow. How do you debug it?
Walk the interviewer through a clear step-by-step checklist: run EXPLAIN / EXPLAIN ANALYZE to check for full table scans, verify whether WHERE or JOIN columns are indexed, avoid wrapping indexed columns in functions (like YEAR(created_at) = 2026 instead of a date range), replace SELECT * with needed columns, and check for lock contention.
33. How do you prevent duplicate bookings in a ticket reservation system?
Combine a UNIQUE constraint on (event_id, seat_number) at the database level with an atomic transaction using row-level locking (SELECT ... FOR UPDATE) or an atomic conditional UPDATE seats SET status = 'BOOKED' WHERE id = ? AND status = 'AVAILABLE'.
34. What is Connection Pooling, and why does it matter in backend interviews?
Opening a fresh TCP + authentication connection to a database per HTTP request is slow and exhausts DB memory. Connection pools (like HikariCP in Java or pgBouncer for PostgreSQL) maintain reusable open connections to handle concurrent traffic cleanly.
35. What DBMS topics do service-based companies ask most often?
From candidate reports in our Infosys Interview Questions 2026 and Capgemini Exceller Interview Experience 2027 breakdowns, panels most frequently ask: 2nd/Nth highest salary SQL query, ACID properties with banking examples, 1NF to 3NF normalization, DELETE vs TRUNCATE, and primary vs unique keys.
Quick 6-Point DBMS Revision Checklist Before Your Interview
- Draw an ER diagram and map 1:1, 1:N, and M:N relationships to tables in under 2 minutes.
- State 1NF, 2NF, 3NF, and BCNF in one crisp sentence each with a concrete anomaly example.
- Explain ACID using a bank transfer scenario and map each isolation level to Dirty/Non-Repeatable/Phantom reads.
- Contrast Clustered vs. Non-Clustered indexes and explain when an index hurts write speed.
- Write
JOIN,GROUP BY + HAVING, and window-function (DENSE_RANK) queries cleanly on paper. - Review SQL Interview Questions for Freshers 2027 to pair theory with hands-on query practice.
Frequently Asked Questions (FAQs)
1. Are DBMS interview questions for freshers mostly theoretical or query-based?
They are a mix of both. Expect 60% conceptual questions (keys, normalization, ACID, indexing, joins) and 40% practical SQL queries or small schema-design prompts.
2. Which database should freshers mention on their resume—MySQL or PostgreSQL?
Either is great as long as you know its fundamentals. MySQL (InnoDB) and PostgreSQL are both widely used in campus projects and support ACID transactions, B+ Tree indexes, and standard SQL.
3. Is BCNF mandatory to learn for fresher placements?
Yes—at least the definition and how it differs from 3NF. You rarely need to prove lossless-join decomposition mathematically in service-based interviews, but product startups often ask the 3NF vs. BCNF distinction.
4. What is the difference between NoSQL and RDBMS if an interviewer asks?
RDBMS uses fixed schemas, ACID transactions, and SQL joins (ideal for banking, orders, and structured relationships). NoSQL databases (like MongoDB or Redis) offer flexible schemas and horizontal scaling for unstructured documents, caching, or high-throughput event streams.
5. How many days does it take to prepare DBMS for placements?
With focused effort, 4 to 5 days of structured revision—covering keys, normalization, ACID, indexing, and 30–40 SQL queries—is enough to answer fresher DBMS rounds confidently.
