A lateral derived table is a special type of derived table. You can use the LATERAL keyword to specify a derived table that can reference columns of preceding tables or derived tables defined in the same FROM clause. This way, subqueries in a derived table can depend on tables defined in the same FROM clause and therefore access the column values of those tables.
The main feature of lateral derived tables is that they can reference columns in tables that are defined previously in the FROM clause, while ordinary derived tables cannot.
Examples
SELECT *
FROM A, LATERAL (SELECT * FROM B WHERE B.col1 = A.col1) AS derived_table;
References
For more information about lateral derived tables, see Lateral derived tables.