COALESCE NULLIF to_jsonb jsonb_agg array_agg FILTER: SELECT sum(id) FILTER (where id % 2 = 1) FROM cs; NTH_VALUE -- https://www.postgresqltutorial.com/postgresql-nth_value-function/ FIRST_VALUE/LAST_VALUE RANK / DENSE_RANK [1/1/3/3/5 1/1/2/2/3] RANK() OVER ( [PARTITION BY partition_expression, ... ] ORDER BY sort_expression [ASC | DESC], ... ) NTILE (n) OVER (...) -- Similar to Rank, but most Nth value, as average as possible => Rank: 1/2/3/4/5 Ntile(3) => 1/1/2/2/3/ Like Level ? ROW_NUMBER (1/2/3/4...) ROW_NUMBER() OVER( [PARTITION BY column_1, column_2,…] [ORDER BY column_3,column_4,…] ) --Last Nth row value! https://www.postgresqltutorial.com/postgresql-lag-function/ LAG(expression [,offset [,default_value]]) OVER ( [PARTITION BY partition_expression, ... ] ORDER BY sort_expression [ASC | DESC], ... ) SELECT year, amount, group_id, LAG(amount,1) OVER ( PARTITION BY group_id ORDER BY year ) previous_year_sales FROM sales; --Next Nth row value! https://www.postgresqltutorial.com/postgresql-lead-function/ LEAD(expression [,offset [,default_value]]) OVER ( [PARTITION BY partition_expression, ... ] ORDER BY sort_expression [ASC | DESC], ... ) --Fetch(Replacement of Limit) https://www.postgresqltutorial.com/postgresql-fetch/ FETCH FIRST/NEXT 1 ROW ONLY; == LIMIT 1 OFFSET 5 ROWS FETCH FIRST 5 ROW ONLY; == LIMIT 5, 5