14 min read
Updated Aug 2026
2026 Placement Edition
25 Most Asked DBMS Interview Questions (TCS, Infosys & Accenture 2026)
A definitive, campus-tested interview playbook covering essential database architecture, keys, normalization, ACID transactions, indexing, and rapid revision cards designed for top mass and product recruiter rounds.
Frequently Asked In:
TCS NQT & Digital
Infosys SP/DSE
Accenture ASE/FADA
Wipro Turbo
Cognizant GenC
Capgemini
25
Core Interview Questions
100%
Beginner & Placement Friendly
10
Rapid Flashcard Cards
10+
Diagrams & SQL Snippets
A Database Management System (DBMS) is system software that serves as an interface between end-users and the database, allowing data storage, retrieval, concurrency control, and transactional integrity (e.g. MySQL, PostgreSQL, Oracle).
Section 1
DBMS Architecture & Core Fundamentals
What is the difference between DBMS and RDBMS?
DBMS stores data as files and does not establish relationships between tables or enforce tabular constraints. RDBMS (Relational DBMS) stores data in structured tables (relations) with rows and columns, enforcing primary/foreign keys, relational algebra, and ACID constraints.
| Feature |
DBMS |
RDBMS |
| Data Structure |
Flat files or hierarchical navigation |
Tabular (Rows & Columns) |
| Normalization |
Not supported or enforced |
Fully supported to reduce redundancy |
| Integrity Constraints |
Not supported natively |
Enforced via Primary/Foreign Keys |
| Examples |
File System, XML, dBase |
PostgreSQL, MySQL, Oracle, SQLite |
Interview Tip: When interviewers ask this at TCS/Infosys, mention that "All RDBMS are DBMS, but not all DBMS are RDBMS." Give real-world examples immediately.
Follow-up Question:
Is MongoDB a DBMS or RDBMS? (Answer: MongoDB is a NoSQL Document DBMS, not an RDBMS because it lacks tabular relations).
Explain the 3-Schema Architecture (ANSI/SPARC) in DBMS.
The 3-Schema architecture separates the user application view from the physical database storage to achieve Data Independence:
- External Level (View Level): Describes the portion of the database relevant to a specific user group.
- Conceptual Level (Logical Level): Describes what data is stored, including entities, data types, and relationships (the whole database design).
- Internal Level (Physical Level): Describes physical storage structures, indexing, file organization, and compression on disk.
Common Mistake: Don't confuse Schema (the structural blueprint) with Instance (the data stored at a specific point in time).
What is Data Independence? Differentiate Physical vs Logical Data Independence.
Data Independence is the ability to modify a schema definition at one level without affecting the schema definition at the next higher level.
- Logical Data Independence: Ability to alter the conceptual schema (e.g. adding a new attribute or table) without having to rewrite external views or user queries.
- Physical Data Independence: Ability to alter internal storage structures (e.g. switching from HDD to SSD, adding B-Tree indexes) without changing the conceptual schema.
Recruiter Check: Logical data independence is much harder to achieve than physical data independence because application code directly interacts with conceptual entities.
What are the different types of Database Languages? (DDL, DML, DCL, TCL)
SQL is categorized into 4 sub-languages depending on operation type:
| Category |
Full Form |
Commands |
Purpose |
| DDL |
Data Definition Language |
CREATE, ALTER, DROP, TRUNCATE |
Defines database structure/schema. Auto-commits. |
| DML |
Data Manipulation Language |
SELECT, INSERT, UPDATE, DELETE |
Retrieves & modifies row data. |
| DCL |
Data Control Language |
GRANT, REVOKE |
Manages user permissions & access security. |
| TCL |
Transaction Control Language |
COMMIT, ROLLBACK, SAVEPOINT |
Manages database transaction execution. |
What is the difference between DELETE, TRUNCATE, and DROP?
This is one of the top 3 most frequently asked comparison questions in mass hiring technical assessments:
| Property |
DELETE |
TRUNCATE |
DROP |
| Type |
DML Command |
DDL Command |
DDL Command |
| Operation |
Deletes specified rows using WHERE |
Deletes ALL rows, preserves structure |
Deletes table structure AND data entirely |
| Speed |
Slower (logs row-by-row deletions) |
Ultra-fast (deallocates data pages) |
Instant deallocation |
| Rollback |
Yes (Can be rolled back in transaction) |
Cannot be rolled back in most RDBMS |
Cannot be rolled back |
| Trigger |
Fires ON DELETE triggers |
Does not fire triggers |
Does not fire triggers |
-- 1. DELETE specific records (Rollback possible)
DELETE FROM Employees WHERE Department = 'Marketing';
-- 2. TRUNCATE entire table rows (Resets identity counter)
TRUNCATE TABLE TempLogs;
-- 3. DROP entire table schema and data
DROP TABLE OldArchive2024;
Section 2
Keys, Relationships & Integrity Constraints
Explain Super Key, Candidate Key, Primary Key, and Foreign Key with examples.
Database keys uniquely identify rows and enforce referential integrity:
- Super Key: Any set of one or more attributes that can uniquely identify a tuple in a relation.
- Candidate Key: A minimal super key with no redundant attributes. A table can have multiple candidate keys.
- Primary Key: The chosen candidate key by the DBA. It MUST NOT contain NULL values and must be unique.
- Alternate Key: All candidate keys that were not chosen as the primary key.
- Foreign Key: An attribute in a table that references the Primary Key of another table, establishing a parent-child relation.
-- Candidate Keys: {RollNo}, {Email}, {AadhaarNo}
-- Chosen Primary Key: RollNo
-- Alternate Keys: Email, AadhaarNo
-- Super Keys: {RollNo}, {RollNo, Name}, {Email, Name}, etc.
-- Foreign Key: DeptID references Department(DeptID)
Don't Confuse: A Primary Key cannot contain NULLs, but a Unique Key allows at most one NULL value (in SQL Server/Oracle) or multiple NULLs (in MySQL/Postgres standard).
What is Referential Integrity and what are ON DELETE CASCADE / SET NULL?
Referential Integrity guarantees that a foreign key value in a child table must always correspond to an existing primary key in the parent table.
When a parent row is deleted, foreign key constraints define the cascade behavior:
ON DELETE CASCADE: Automatically deletes all associated child rows.
ON DELETE SET NULL: Sets foreign key values in the child table to NULL.
ON DELETE RESTRICT / NO ACTION: Rejects the deletion of the parent row if child rows exist.
What is the difference between WHERE and HAVING clause in SQL?
WHERE filters individual records before grouping occurs. HAVING filters aggregated groups after the GROUP BY clause is applied.
-- WHERE filters rows before aggregation; HAVING filters aggregated results
SELECT Department, COUNT(*) AS TotalEmployees, AVG(Salary) AS AvgSalary
FROM Employees
WHERE ActiveStatus = 1 -- Row-level filter
GROUP BY Department
HAVING AVG(Salary) > 50000; -- Group aggregate filter
Explain the different types of SQL Joins (INNER, LEFT, RIGHT, FULL, CROSS).
- INNER JOIN: Returns rows that have matching values in both tables.
- LEFT (OUTER) JOIN: Returns all rows from the left table, and matched rows from the right table (unmatched right columns are
NULL).
- RIGHT (OUTER) JOIN: Returns all rows from the right table, and matched rows from the left table.
- FULL (OUTER) JOIN: Returns all rows when there is a match in either table.
- CROSS JOIN: Returns the Cartesian product of rows from both tables ($N \times M$).
How to find the N-th Highest Salary in SQL?
Two standard approaches asked in Accenture and TCS Digital interviews:
-- 1. Using Modern Window Functions (DENSE_RANK)
WITH RankedSalaries AS (
SELECT EmployeeName, Salary,
DENSE_RANK() OVER (ORDER BY Salary DESC) as RankNum
FROM Employees
)
SELECT EmployeeName, Salary
FROM RankedSalaries
WHERE RankNum = 2; -- 2nd highest salary
-- 2. Using Subquery (Classic)
SELECT MAX(Salary) FROM Employees
WHERE Salary < (SELECT MAX(Salary) FROM Employees);
Section 3
Normalization & Anomalies (1NF to BCNF)
What is Normalization? What database anomalies does it prevent?
Normalization is the systematic process of decomposing relations to eliminate data redundancy and prevent data anomalies:
- Insertion Anomaly: Inability to insert certain data without inserting unrelated data.
- Deletion Anomaly: Loss of unintended data when deleting another piece of information.
- Update Anomaly: Data inconsistency caused by updating data in some rows but not all copies.
Explain 1NF, 2NF, 3NF, and BCNF with concise rules.
Remember this progressive hierarchy for your interviews:
| Normal Form |
Mandatory Requirement |
Eliminates |
| 1NF |
Every attribute must hold atomic (indivisible) values. No multivalued attributes or repeating groups. |
Multi-valued cells |
| 2NF |
Must be in 1NF + No Partial Dependency (no non-prime attribute depends on a proper subset of any candidate key). |
Partial Dependencies |
| 3NF |
Must be in 2NF + No Transitive Dependency (for $X \rightarrow Y$, either $X$ is a superkey or $Y$ is a prime attribute). |
Transitive Dependencies ($A \rightarrow B \rightarrow C$) |
| BCNF |
Stricter 3NF: For every non-trivial functional dependency $X \rightarrow Y$, $X$ MUST be a Super Key. |
All functional dependency redundancies |
Quick Memory Rule: "The key (1NF), the whole key (2NF), and nothing but the key (3NF), so help me Codd (BCNF)."
What is Denormalization and when is it preferred?
Denormalization is an optimization strategy where redundant data is deliberately added back to normalized tables to reduce costly JOIN operations in read-heavy analytics (OLAP) workloads and data warehouses.
Section 4
Transactions & ACID Properties
Explain ACID Properties in DBMS with an ATM Bank Transfer Example.
A transaction is a logical unit of database work. It must satisfy ACID:
- Atomicity (All or Nothing): The entire transaction succeeds or rolls back completely. Managed by the Recovery Manager.
- Consistency: Database must transition from one valid state to another, preserving all integrity constraints.
- Isolation: Concurrent transactions execute independently without interference. Managed by the Concurrency Control Manager.
- Durability: Once committed, changes persist permanently in non-volatile storage, even during power loss. Managed by the Log Manager / WAL.
ATM Example: Transferring ₹5,000 from Account A to Account B. If ₹5,000 is debited from A but the system crashes before crediting B, Atomicity ensures A's ₹5,000 is refunded via ROLLBACK.
What are the Transaction States in DBMS?
A transaction goes through 6 lifecycle states:
- Active: Initial state; transaction operations are executing.
- Partially Committed: Final statement has executed, but changes are not yet flushed to disk.
- Committed: Successfully executed and permanent.
- Failed: Normal execution can no longer proceed due to hardware/software check failure.
- Aborted: Transaction rolled back and database restored to prior state.
- Terminated: Transaction leaves the system.
What are Concurrency Problems? (Dirty Read, Non-Repeatable Read, Phantom Read)
When multiple transactions execute concurrently without proper isolation levels:
- Dirty Read (Uncommitted Dependency): Transaction $T_2$ reads data modified by $T_1$ which is subsequently rolled back.
- Non-Repeatable Read: $T_1$ reads a row twice, but between reads, $T_2$ updates or deletes that row, giving conflicting data.
- Phantom Read: $T_1$ queries a range of rows twice, but $T_2$ inserts a new row matching that range between queries.
What are SQL Isolation Levels?
| Isolation Level |
Dirty Read |
Non-Repeatable Read |
Phantom Read |
| Read Uncommitted |
❌ Allowed |
❌ Allowed |
❌ Allowed |
| Read Committed |
✅ Prevented |
❌ Allowed |
❌ Allowed |
| Repeatable Read |
✅ Prevented |
✅ Prevented |
❌ Allowed |
| Serializable |
✅ Prevented |
✅ Prevented |
✅ Prevented |
Section 5
Indexing, Query Optimization & Concurrency
What is Database Indexing? Differentiate Clustered vs Non-Clustered Index.
An Index is an auxiliary data structure (usually a B+ Tree) that speeds up data retrieval without scanning every row in a table.
- Clustered Index: Dictates the physical order of data rows on disk. A table can have only ONE clustered index (usually the Primary Key).
- Non-Clustered Index: Stored separately from the data rows. Contains key values and pointers (Row IDs) to the physical rows. A table can have multiple non-clustered indexes.
What is a B+ Tree and why is it preferred for database indexing over Binary Search Trees?
B+ Trees have high fan-out (wide branching factor), which minimizes disk I/O operations. In B+ Trees, all actual data pointers are located strictly in leaf nodes, and leaf nodes are linked as a doubly-linked list, making sequential range scans extremely fast.
What is Deadlock in DBMS and how is it detected?
A Deadlock is a condition where two or more transactions are waiting indefinitely for locks held by each other (e.g. $T_1$ holds Lock A and waits for B, while $T_2$ holds Lock B and waits for A). It is detected using a Wait-For Graph (WFG) where a cycle indicates a deadlock.
What is Two-Phase Locking (2PL) Protocol?
2PL guarantees serializability by dividing lock acquisition into two distinct phases:
- Growing Phase: Transaction may acquire locks, but cannot release any.
- Shrinking Phase: Transaction may release locks, but cannot acquire any new locks.
What is the difference between a View and a Materialized View?
A standard View is a virtual table containing no physical data (the underlying query runs every time the view is referenced). A Materialized View physically stores the query result on disk and must be refreshed periodically, enabling high-performance reads on expensive calculations.
What are Stored Procedures and Triggers?
- Stored Procedure: Precompiled set of SQL statements stored on the database server that can be explicitly invoked with parameters.
- Trigger: Special stored procedure that automatically executes (fires) in response to specific DML events (
BEFORE/AFTER INSERT, UPDATE, DELETE) on a specified table.
What is Write-Ahead Logging (WAL)?
WAL is a core durability protocol where any modification is first recorded in a persistent append-only transaction log before being written to the actual database data pages on disk. This ensures crash recovery can replay committed transactions.
SQL vs NoSQL: When should you choose each?
| Dimension |
SQL (Relational) |
NoSQL (Non-Relational) |
| Data Schema |
Fixed, rigid predefined schema |
Dynamic, flexible schema (JSON/Key-Value) |
| Scaling |
Vertical (Bigger server hardware) |
Horizontal (Distributed node clusters) |
| ACID vs BASE |
Strict ACID Compliance |
BASE (Basically Available, Soft State, Eventual Consistency) |
| Best Use Case |
Banking, ERP, E-commerce transactions |
Real-time feeds, IoT streams, Big Data logs |
Section 6
10 Rapid Placement Revision Flashcards
Click any card to reveal the 10-second memory punchline before your interview!
#1
Primary Key vs Unique Key?
Primary Key forbids NULLs and only 1 per table; Unique Key allows NULL and multiple can exist.
#2
2NF Condition?
1NF + No partial dependency (no non-prime attribute depends on subset of candidate key).
#3
3NF Condition?
2NF + No transitive dependency ($X \rightarrow Y$ requires $X$ is superkey or $Y$ is prime).
#4
BCNF Condition?
For every non-trivial $X \rightarrow Y$, $X$ MUST be a super key.
#5
TRUNCATE vs DELETE?
TRUNCATE is DDL (fast, resets identity, no WHERE); DELETE is DML (slow, row-logged, accepts WHERE).
#6
ACID Acronym?
Atomicity (all/none), Consistency (rules), Isolation (independence), Durability (persists).
#7
Clustered Index Limit?
Exactly ONE clustered index per table because physical data can only be sorted in one order.
#8
HAVING vs WHERE?
WHERE filters rows before GROUP BY; HAVING filters aggregated groups after GROUP BY.
#9
Dirty Read?
Reading uncommitted data modified by another transaction that later rolls back.
#10
Deadlock Check?
Cycles in a Wait-For Graph (WFG) indicate circular wait deadlock.
Section 7
Campus Placement Technical Round FAQ
Extremely important. In TCS NQT/Digital, Infosys DSE/SP, and Accenture interviews, DBMS questions (especially SQL queries, keys, normalization, and ACID) account for roughly 35-40% of technical questions asked to CS, IT, and non-CS engineering students.
Yes. The most frequent live coding queries are finding the 2nd highest salary, retrieving employees who joined in a specific year, counting employees per department using GROUP BY/HAVING, and self-joins for Employee-Manager hierarchies.
NoSQL is rarely tested deeply in fresher campus drives. Having strong relational concepts (SQL, Normalization, ACID, Indexing) and being able to explain when to use SQL vs NoSQL (CAP theorem overview) is more than enough.