Fundamentals

0001-01-01

What is an SQL Relation?

A table is a relation with storage. Every SQL query you write defines a new relation, assembled on the fly from relations that already exist.

0001-01-01

GROUP BY and HAVING: Thinking in Groups

GROUP BY compresses many rows into one per group. Understanding the evaluation order — WHERE, then GROUP BY, then HAVING, then SELECT — is what makes aggregation queries predictable.

0001-01-01

The Three Database Anomalies

Storing the same fact in more than one place is the root cause of three predictable failures. Understanding update, insertion, and deletion anomalies is what makes normalization feel obvious rather than arbitrary.

0001-01-01

NULL in SQL: Three-Valued Logic

NULL is not zero, not an empty string, not false. It means unknown — and that single word explains every surprising thing SQL does with it, from WHERE conditions that silently drop rows to comparisons that never return true.