SQL from Scratch

Цикл для тех, кто не писал ни одного запроса: что такое база данных, SELECT и фильтры, JOIN, агрегаты, оконные функции, NULL, безопасное изменение данных и первое понимание индексов.

Behind every application stands a database, and the ability to ask it a question directly is the skill that separates a specialist from a user. This series is for those who haven't written a single query yet: no prerequisites, one running example of an online store.

Eight articles go in order — each builds on the previous ones:

  1. What a database and tables are — the DBMS, rows and columns, the primary key and relationships.
  2. SELECT: pick, filter, sort — WHERE, LIKE, IN, ORDER BY, LIMIT.
  3. JOIN: combine data from several tables — INNER and LEFT, lost and duplicated rows.
  4. Aggregates: COUNT, GROUP BY and HAVING — answering "how many" and "for what total."
  5. Window functions — ROW_NUMBER and PARTITION BY: counting without collapsing rows.
  6. NULL and data types — where everyone stumbles, from IS NULL to time zones.
  7. INSERT, UPDATE, DELETE and transactions — how to change data without causing a disaster.
  8. Why a query is slow: indexes on your fingers — the full scan, the index as a table of contents, EXPLAIN.

The series is part of the "Manual testing from scratch" program as a separate phase, yet self-sufficient: SQL is equally needed by a tester, an analyst, and a beginning developer. The continuation for those who want more is the PostgreSQL section.