Skip to main content

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 · 7

SELECT, FROM, WHERE, ORDER BY, LIMIT, DISTINCT, aliases

Filtering

02 · 6

AND, OR, IN, BETWEEN, LIKE, IS NULL, EXISTS

Aggregation

03 · 7

COUNT, SUM, AVG, GROUP BY, HAVING, FILTER

Joins

04 · 6

INNER, LEFT, RIGHT, FULL OUTER, CROSS, USING

Subqueries

05 · 5

Scalar, correlated, IN, EXISTS, derived tables

CTEs

06 · 3

WITH, chained CTEs, recursive CTE

Window Functions

07 · 9

OVER, PARTITION BY, ROW_NUMBER, RANK, LAG, LEAD, NTILE

String Functions

08 · 9

UPPER, LENGTH, TRIM, SUBSTRING, CONCAT, REPLACE

Date & Time

09 · 8

NOW, DATE_TRUNC, EXTRACT, AGE, intervals, TO_CHAR

Type Casting

10 · 5

CAST, :: shorthand, numeric precision

Conditionals

11 · 3

CASE WHEN, COALESCE, NULLIF

Math

12 · 5

Arithmetic, ROUND, FLOOR, ABS, POWER

Set Operations

13 · 4

UNION, 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.