SQL — Complete Tutorial Index

Namaste SQL — Complete Tutorial Index

Hey everyone! Welcome to Namaste SQL! 🙏

Every backend developer writes SQL. Very few can explain what happens when two people write the same row at the same time. This series covers both halves: the queries you write every day, and the guarantees the database quietly makes underneath them.

Every topic is taught the same way: plain-English idea → ASCII picture → the query → the gotcha → interview Q&A.

┌─────────────────────────────────────────────────────────────────┐
│                  NAMASTE SQL — ROADMAP                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  SEASON 1 — QUERIES & INTERVIEWS   (Episode 01)                │
│  SEASON 2 — TRANSACTIONS & ACID    (Episode 02)                │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Legend: ✅ = ready to read    More episodes coming!


SEASON 1 — Queries & Interviews

"First, learn to ask the database the right question."

✅ Episode 01 — SQL Deep Dive: Everything Interviews Ask You    → Read Episode

What you'll learn:
──────────────────
✔ SELECT, WHERE, GROUP BY, HAVING — and the order they REALLY run in
✔ All the JOINs, drawn as pictures (inner, left, right, full, self)
✔ Subqueries vs CTEs vs window functions
✔ Indexes — why your query is slow and how an index fixes it
✔ Normalization (1NF, 2NF, 3NF) without the textbook pain
✔ The classic interview queries: 2nd highest salary, duplicates, top-N per group

Key Concept: SQL is declarative — you describe WHAT you want, not how to get it.

SEASON 2 — Transactions & ACID

"Two users. One row. One winner. Who decides?"

✅ Episode 02 — Race Conditions in SQL & ACID Properties    → Read Episode

What you'll learn:
──────────────────
✔ What a race condition looks like in a real database
✔ ACID — Atomicity, Consistency, Isolation, Durability (each one explained)
✔ The isolation levels: Read Uncommitted → Serializable
✔ Dirty reads, non-repeatable reads, phantom reads — the 3 anomalies
✔ Optimistic vs pessimistic locking
✔ SELECT ... FOR UPDATE — the fix you'll actually use in production

Key Concept: Without isolation, "it worked on my machine" becomes "it broke in production".

Topic Map

TopicEpisodeStatus
Queries, JOINs, indexes, normalization01✅ Done
Transactions, ACID, isolation levels, locking02✅ Done

How to Use This Series

1. Episode 01 is the "can you write SQL?" round. Episode 02 is the
   "do you understand databases?" round. Interviews ask both.
2. Draw every JOIN as two overlapping circles until it's automatic.
3. Race conditions are the #1 real-world SQL bug. Read Episode 02
   even if you think you already know ACID.

Keep querying, keep learning! See you in the episodes!