Function that derives one geometry from many
Use the ST_Union function to derive individual geometries from multiple geometries. ST_Union combines two geometries into a single geometry.
ST_Union
The ST_Union function returns the union set of two geometries.
This operation is the spatial equivalent of the logical operator OR. The two geometries must be of the same dimension. ST_Union always returns the result as a collection.
ST_UnionAggr
The ST_UnionAggr function is a union aggregate function that works as a scalar function. This function returns a result for each row.
The result is the union of the geometry on that row and all of the geometries of the previous rows. The result of the final row is the union of all the geometries of that column.