pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: michal.palenik@freemap.sk
Subject: nicer examples for aggregate  calls
Date: Sat, 23 Oct 2021 13:51:48 +0000
Message-ID: <163499710897.684.7420075366995883688@wrigleys.postgresql.org> (raw)

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;


view thread (3+ messages)  latest in thread

Message-ID: <163499710897.684.7420075366995883688@wrigleys.postgresql.org>
Permalink:  ../163499710897.684.7420075366995883688@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/163499710897.684.7420075366995883688@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, michal.palenik@freemap.sk
  Subject: Re: nicer examples for aggregate  calls
  In-Reply-To: <163499710897.684.7420075366995883688@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox