Database Management System concepts: ACID, transactions, normalization, indexing, and NoSQL vs SQL.
5 Questions Detailed Answers
1What are ACID properties?
Easy
View Answer
Atomicity: transaction is all-or-nothing. Consistency: database moves from one valid state to another. Isolation: concurrent transactions don't interfere. Durability: committed data survives system failure. Example: bank transfer — debit and credit must both succeed or both fail (Atomicity).
2What is the difference between SQL and NoSQL databases?
3Explain database transactions and isolation levels.
Hard
View Answer
Isolation levels (weakest to strongest): READ UNCOMMITTED (dirty reads possible), READ COMMITTED (default in most DBs), REPEATABLE READ (prevents non-repeatable reads), SERIALIZABLE (full isolation, slowest). Higher isolation = fewer anomalies but lower concurrency.
4What is a stored procedure vs a function?
Medium
View Answer
Stored procedure: precompiled SQL, can modify data, return multiple values, use transactions. Called with CALL/EXEC. Function: returns a single value, can be used in SELECT statements, typically no side effects. Functions are used in queries, procedures for business logic.
5What is denormalization? When should you use it?
Medium
View Answer
Denormalization intentionally adds redundancy to reduce joins and improve read performance. Use when: (1) Read-heavy workloads, (2) Complex joins causing slow queries, (3) Reporting/analytics tables. Trade-off: faster reads but slower writes, data inconsistency risk. Common in data warehouses.