date: 2025-07-19
topics: [sql, database, transactions, isolation, backend]
day: 4
π Day 4 β Core SQL Concepts Revised + Hands-On Practice
β
What I Worked On
- Revised foundational SQL topics using hands-on CLI practice
- Created markdown notes with query examples
- Simulated transaction isolation anomalies in PostgreSQL
- Documented all concepts with diagrams + real-world analogies
π What I Learned
- β
Transactions:
BEGIN
, COMMIT
, ROLLBACK
β atomic, consistent operations
- β
ACID Properties:
- A β Atomicity: All or nothing (e.g., βΉ100 isnβt deducted if transfer fails)
- C β Consistency: Always valid data (e.g., no -βΉ50 balances)
- I β Isolation: No user clashes (e.g., only one person books a seat)
- D β Durability: Changes survive crashes (e.g., your booking is saved even after a power cut)
- β
Isolation Levels (with hands-on examples):
- πΉ
READ UNCOMMITTED
β dirty reads allowed
- πΉ
READ COMMITTED
β no dirty reads; non-repeatable reads possible
- πΉ
REPEATABLE READ
β consistent row reads; phantom reads may occur
- πΉ
SERIALIZABLE
β strictest; full isolation, full locking
- β
Normalization:
- 1NF β Atomic columns
- 2NF β Remove partial dependency
- 3NF β Remove transitive dependency
- β
Database Design: foreign keys, indexing strategies, table relationships
- β
SQL Axioms & Keys:
- Primary Key
- Foreign Key
- Composite Key
- Candidate Key
β Blockers
- Took time to simulate and understand isolation-level behaviors (e.g., phantom reads)
- Differentiating
REPEATABLE READ
and SERIALIZABLE
in practice
π§ Reflection
Finally got clarity on why ACID matters in real-world apps β banking, ticketing, and payments. Simulating SQL anomalies in real-time made it all click. Isolation levels are no longer just theory β I can explain and apply them.
πΈ Isolation Level Visuals
π Repeatable Read

π Serializable

π Read Committed

π« Read Uncommitted

π References / Code