FIND YOUR NEXT FEW LINES
The snippet library.
Small, practical examples. Search by task or narrow things down below.
5 snippets foundClear filters
Calculate a running total
Accumulate values in row order.
window✓ Tested
Compare a row with the previous row
Read a preceding value with LAG.
LAG✓ Tested
Join text rows in a chosen order
Combine values using string_agg.
string_agg✓ Tested
Number rows within each group
Assign ordered row numbers with a window function.
row_number✓ Tested
Replace all matching text
Normalize repeated whitespace with a regular expression.
regexp_replace✓ Tested