What SQL really is, the relational model, and how to think in sets instead of loops.
Before the tricks, the mental model. SQL is a declarative language built on relations — collections of objects that share a definition. Get these foundations right and everything else clicks into place.
There's no secret sauce — learn the two foundations (relations and declarative thinking), then practice in small steps and build from there.
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.
PostgreSQL is not just storage — it is a concurrent data-access service. Here is what that means, and why the PostgreSQL project specifically is the right choice for any serious application.
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.
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.
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.
Go deeper
These lessons are the foundation. The book gives you the complete treatment, with real datasets you can run and the production patterns that turn thousands of lines of code into simple queries.
Get the Book — $89