Skip to content
PostgreSQL

SELECT API Reference

PostgreSQL SELECT features including window functions, CTEs, LATERAL joins and RETURNING.

By EZ4Code Team

SELECT

Advanced SELECT constructs supported by PostgreSQL.

SELECT col, agg() OVER (PARTITION BY ... ORDER BY ...) FROM tbl

Computes a value over a sliding window of rows related to the current row, without collapsing rows.

Returns: ResultSet

WITH name AS (SELECT ...) SELECT ... FROM name

Common Table Expression (CTE) that names a subquery and references it in the outer SELECT.

Returns: ResultSet

SELECT ... FROM a, LATERAL (SELECT ... WHERE a.id = ref) b

LATERAL join allows a subquery in the FROM clause to reference columns of preceding FROM items.

Returns: ResultSet

INSERT|UPDATE|DELETE ... RETURNING cols

Returns rows affected by an INSERT, UPDATE or DELETE, useful for reading generated keys and triggers.

Returns: ResultSet

More PostgreSQL API References