SQL Explainer
Paste any SELECT query and get a clause-by-clause plain-English breakdown — for when you're reading SQL you didn't write.
SELECT
FROM
JOIN
WHERE
GROUP BY
HAVING
ORDER BY
LIMIT
Try:
SQL clause reference
Clauses, in order
| WITH | define named subqueries (CTEs) used below |
| SELECT | choose which columns to return |
| FROM | which table to read from |
| JOIN | merge rows from another table |
| WHERE | filter rows before grouping |
| GROUP BY | group rows with equal values together |
| HAVING | filter groups after aggregation |
| ORDER BY | sort the result rows |
| LIMIT | cap the number of rows returned |
JOIN types
| INNER JOIN | only rows that match in both tables |
| LEFT JOIN | all left rows + matched right (null if none) |
| RIGHT JOIN | all right rows + matched left (null if none) |
| FULL JOIN | all rows from both tables (null where no match) |
| CROSS JOIN | every combination of left × right rows |
Aggregate functions
| COUNT(*) | count all rows in the group |
| COUNT(col) | count non-null values of col |
| SUM(col) | add up all values |
| AVG(col) | arithmetic mean of values |
| MAX(col) | largest value in the group |
| MIN(col) | smallest value in the group |
Common operators
| = / != / <> | equals / not equals |
| > / < / >= / <= | numeric comparisons |
| IS NULL | value is missing / not set |
| IN (...) | value appears in a list |
| LIKE 'x%' | text matches a pattern (% = anything) |
| BETWEEN a AND b | value is within range [a, b] |