> cs·fundamentals
interview 0% an interactive refresher
03 [J][I][A] Stage 1

Databases

Databases, gone deep: SQL, all six JOINs, advanced querying, indexes, transactions/isolation, and NoSQL. Includes the live SQL playground.

chapters
7
objectives
37
core
23
est. time
3h 24m
  1. 01
    3.1 Relational model & SQL basics ★ core

    Keys, SELECT/WHERE/ORDER BY from scratch, and GROUP BY with aggregates — plus the WHERE-vs-HAVING distinction. Practice it live in the playground.

    3 objectives · 2 readings · SQL · 25m
  2. 02
    3.2 JOINs ★ core

    All six JOIN types, the difference between INNER and LEFT from memory, and the classic gotcha where a WHERE filter silently turns a LEFT JOIN into an INNER one.

    7 objectives · 2 readings · SQL · 35m
  3. 03
    3.3 Advanced querying

    Subqueries (correlated vs not), CTEs for readability, and window functions (ROW_NUMBER/RANK/LAG/LEAD/running totals) vs GROUP BY.

    2 objectives · 1 readings · SQL · 28m
  4. 04
    3.4 Indexes & query performance ★ core

    B-tree indexes, the composite-index leftmost-prefix rule, covering indexes, when indexes hurt, reading EXPLAIN, and the N+1 query problem.

    7 objectives · 2 readings · SQL · 32m
  5. 05
    3.5 Schema design & transactions ★ core

    Normalization (1NF–BCNF) and when to denormalize, ACID, and the isolation levels with the exact anomaly each prevents (dirty / non-repeatable / phantom read).

    5 objectives · 1 readings · 30m
  6. 06
    3.6 NoSQL ★ core

    The four NoSQL families and when each fits, BASE vs ACID, and sharding vs replication vs partitioning.

    6 objectives · 1 readings · 26m
  7. 07
    3.7 Stored routines, views & triggers

    The database objects beyond tables: views and materialized views, stored procedures/functions, and triggers — plus UPSERT, full-text search, and JSON/JSONB. Logic and shapes that live in the database itself.

    7 objectives · 4 readings · 28m

Section assessment

Harder, multi-concept questions drawn from across the module. Aim for 75%.

section assessment12 questions · pass ≥ 75%
  1. 01hard

    table_a has 3 rows; for a given a, b has 0, 1, 2 matches respectively. How many rows does `a LEFT JOIN b` produce?

  2. 02hard

    Which lets you rank rows WITHOUT collapsing them into groups?

  3. 03hard

    Given a composite index on (country, city, age), which queries can use it efficiently (leftmost-prefix rule)?

  4. 04hard

    An ORM lazily loads each parent's children, firing 1 + N queries. This is the:

  5. 05hard

    T1 reads a row; T2 updates+commits it; T1 re-reads and sees a different value. This anomaly is a:

  6. 06hard

    Which isolation level prevents dirty reads but still allows non-repeatable reads?

  7. 07hard

    Sharding primarily scales ___, while replication primarily scales ___.

  8. 08medium

    Which aggregate ignores NULLs when counting a specific column, e.g. COUNT(col)?

  9. 09medium

    You can reference a column alias defined in SELECT inside the WHERE clause.

  10. 10medium

    You LEFT JOIN customers→orders and add `WHERE orders.status='shipped'`. Unexpectedly, customers with no orders disappear. Why?

  11. 11medium

    To list employees alongside their manager (same table), you use a:

  12. 12medium

    A CTE (WITH …) primarily improves: