join tutorial: table joined on itself

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: shadiakiki1986(at)gmail(dot)com
Subject: join tutorial: table joined on itself
Date: 2018-09-13 05:08:33
Message-ID: 153681531312.22350.4392709233447748924@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/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)
```

Browse pgsql-docs by date

  From Date Subject
Next Message Peter Eisentraut 2018-09-13 06:55:32 Re: bad url in docs
Previous Message PG Doc comments form 2018-09-09 23:41:36 please inform data_directory