PostgreSQL Aggregates and Grouping Cheat Sheet
Summarize PostgreSQL data with count, sum, averages, filtered and ordered aggregates, HAVING, GROUPING SETS, ROLLUP, CUBE, and grouping indicators.
Open cheat sheetSQL · 9 guides
Retrieve, combine, aggregate, and navigate relational data.
Focused references
Each guide includes copy-ready syntax, detailed examples, and authoritative references.
Summarize PostgreSQL data with count, sum, averages, filtered and ordered aggregates, HAVING, GROUPING SETS, ROLLUP, CUBE, and grouping indicators.
Open cheat sheetStructure PostgreSQL queries with scalar, table, correlated, EXISTS, LATERAL, common table, recursive, and data-modifying expressions.
Open cheat sheetStream PostgreSQL query results safely with cursors, bounded FETCH batches, holdability, row locking, refcursor APIs, and resumable alternatives.
Open cheat sheetWrite PostgreSQL LATERAL and set-returning-function queries for top-N lookups, JSON, arrays, time series, optional expansion, and efficient plans.
Open cheat sheetHandle PostgreSQL unknown values with IS NULL, three-valued logic, COALESCE, NULLIF, CASE, comparison predicates, and null-aware ordering.
Open cheat sheetBuild safe PostgreSQL recursive CTEs for hierarchies and graphs with anchors, termination, paths, SEARCH ordering, CYCLE detection, and bounded execution.
Open cheat sheetAnalyze PostgreSQL rows with ranking, offsets, partitioned aggregates, explicit frames, named windows, and post-window filtering.
Open cheat sheetCombine related PostgreSQL tables with inner, outer, cross, self, multi-table, aggregate, and lateral joins using clear predicates.
Open cheat sheetQuery, filter, sort, group, join, and compose relational data with practical SQL SELECT examples.
Open cheat sheet