🗃️
SQL
SQL Fundamentals — The Questions Interviewers Always Ask First
🗃️
🗃️
SQL · Section 8 of 10

SQL Fundamentals — The Questions Interviewers Always Ask First

🔒

This section is locked

Unlock every deep-dive, lab, mock interview, and memory map across all 10 topics.

View Plans — from ₹299/month

Already have a plan? Sign in

SQL Fundamentals — The Questions Interviewers Always Ask First

Pro Tip
Why this file exists: Patterns (SQL_01–SQL_06) test problem-solving. But before that, interviewers test foundational understanding. If you fumble ACID or can't explain normalization, you won't reach the coding round. Format: Every topic follows — Definition → Simple Explanation → Analogy → Code → Interview Tip → What NOT to say.

SECTION 1: ACID PROPERTIES

Definition (1 line each)

PropertyDefinition
AtomicityA transaction is all-or-nothing — every statement succeeds, or none do.
ConsistencyA transaction moves the database from one valid state to another — all rules/constraints are satisfied.
IsolationConcurrent transactions behave as if they ran one after another.
DurabilityOnce committed, the data survives crashes, power failures, and restarts.

Simple Explanation

Think of a bank transfer — you move ₹5000 from Account A to Account B.

PropertyWhat it means for the transfer
AtomicityEither BOTH the debit from A AND credit to B happen, or NEITHER happens. No half-transfers.
ConsistencyTotal money before = total money after. The system never shows ₹5000 vanished into thin air.
IsolationIf someone checks balances mid-transfer, they see either the before-state or the after-state — never the debit without the credit.
DurabilityOnce the bank says "transfer complete," even if the server crashes 1 second later, the transfer is permanent.

Real-world Analogy

ACID is like a legal contract:

  • Atomicity = The contract is either fully signed by both parties or it's void.
  • Consistency = The contract can't violate any laws.
  • Isolation = Two contracts being signed simultaneously don't interfere with each other.
  • Durability = Once signed and filed, a fire in the building