PostgreSQL 15 · 13 categories · 77 entries
SQL Reference Sheet
A complete PostgreSQL syntax reference covering all essential functions, clauses, and operators. Bookmark for quick lookups while writing queries, or print the one-pager for your desk.
Basics
01 · 7SELECT, FROM, WHERE, ORDER BY, LIMIT, DISTINCT, aliases
Filtering
02 · 6AND, OR, IN, BETWEEN, LIKE, IS NULL, EXISTS
Aggregation
03 · 7COUNT, SUM, AVG, GROUP BY, HAVING, FILTER
Joins
04 · 6INNER, LEFT, RIGHT, FULL OUTER, CROSS, USING
Subqueries
05 · 5Scalar, correlated, IN, EXISTS, derived tables
CTEs
06 · 3WITH, chained CTEs, recursive CTE
Window Functions
07 · 9OVER, PARTITION BY, ROW_NUMBER, RANK, LAG, LEAD, NTILE
String Functions
08 · 9UPPER, LENGTH, TRIM, SUBSTRING, CONCAT, REPLACE
Date & Time
09 · 8NOW, DATE_TRUNC, EXTRACT, AGE, intervals, TO_CHAR
Type Casting
10 · 5CAST, :: shorthand, numeric precision
Conditionals
11 · 3CASE WHEN, COALESCE, NULLIF
Math
12 · 5Arithmetic, ROUND, FLOOR, ABS, POWER
Set Operations
13 · 4UNION, UNION ALL, INTERSECT, EXCEPT
Next step
Ready to practice?
Apply these functions in the live playground against real PostgreSQL sandboxes. The schema explorer keeps this reference right beside your editor.