nicer examples for aggregate calls

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: michal(dot)palenik(at)freemap(dot)sk
Subject: nicer examples for aggregate calls
Date: 2021-10-23 13:51:48
Message-ID: 163499710897.684.7420075366995883688@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/tutorial-agg.html
Description:

currently, all of the examples are very simple, like

SELECT city, max(temp_lo)
FROM weather
WHERE city LIKE 'S%' -- (1)
GROUP BY city
HAVING max(temp_lo) < 40;

this example would be more complex and would allow users to search for
clause "filter":

Finally, if we only care about cities whose names begin with ā€œSā€ and we want
to calculate the number of observations in each city with temp_lo over 30,
we might do:

SELECT city, max(temp_lo), count(*) filter (temp_lo>30),
FROM weather
WHERE city LIKE 'S%' -- (1)
GROUP BY city
HAVING max(temp_lo) < 40;

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2021-10-23 14:45:12 Re: information_schema.tables table broken in versions 13+
Previous Message Alexander Lakhin 2021-10-22 20:20:20 Re: The huge_pages parameter doesn't work when shared_memory_type is sysv