A free, self-paced textbook in 7 chapters. Read a chapter, then drill it with the 120 companion flashcards using spaced repetition.
SQL, or Structured Query Language, is the standard language for querying and manipulating relational data. At its core, every data-retrieval query begins with the SELECT statement,...
Joins are how you combine rows from multiple related tables, and choosing the right join type determines which rows appear in the output. An INNER JOIN returns only rows with match...
Aggregation compresses many rows into summary values. The standard aggregate functions are COUNT, SUM, AVG, MIN, and MAX; COUNT totals the number of rows (or non-NULL values in a s...
Window functions perform calculations across a set of rows that are related to the current row, but unlike aggregates they do not collapse the result set — every input row still ap...
A subquery is a query nested inside another query — in SELECT, FROM, WHERE, or HAVING — and provides a way to compute a value or set of values that the outer query then uses. A non...
Beyond the basic comparison operators, SQL offers specialized tools for working with strings, ranges, and conditional logic. The LIKE operator performs pattern matching on string c...
Indexes are data structures — typically B-trees — that speed up lookups at the cost of additional storage and slower writes. A clustered index determines the physical order of data...