public inbox for [email protected]
help / color / mirror / Atom feedFrom: PG Doc comments form <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: join tutorial: table joined on itself
Date: Thu, 13 Sep 2018 05:08:33 +0000
Message-ID: <[email protected]> (raw)
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/10/static/tutorial-join.html
Description:
Thanks for the effort for this wonderful tutorial.
The last table that illustrates joining a table on itself shows that San
Fransisco has `temp_lo` lower than itself and `temp_hi` higher than itself,
without including the dates of the temperatures. I believe it would be
clearer (data-wise) if the table included the dates fields `W1.date as date`
and `W2.date as date`, making the whole example output look as follows
```
SELECT W1.city, W1.date as date, W1.temp_lo AS low, W1.temp_hi AS high
W2.city, W2.date as date, W2.temp_lo AS low, W2.temp_hi AS high
FROM weather W1, weather W2
WHERE W1.temp_lo < W2.temp_lo
AND W1.temp_hi > W2.temp_hi;
city | date | low | high | city | low | high
---------------+-----+-----+------+---------------+-----+------
San Francisco | 1994-11-29 | 43 | 57 | San Francisco | 1994-11-27 |
46 | 50
Hayward | 1994-11-29 | 37 | 54 | San Francisco | 1994-11-27 | 46
| 50
(2 rows)
```
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: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: join tutorial: table joined on itself
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox