pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
self join
2+ messages / 2 participants
[nested] [flat]

* self join
@ 2019-04-10 09:19 PG Doc comments form <noreply@postgresql.org>
  2019-04-10 23:34 ` Re: self join Euler Taveira <euler@timbira.com.br>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2019-04-10 09:19 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: francis.ebbs@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/tutorial-join.html
Description:

The example of self join shows two resulting records.
I have checked the input data. 
There are three output records with lower lo and higher high temperatures 

We seem to be missing, in the answer, a third record:
( (San Francisco, 46, 50) , (Hayward, 54, 37 ))


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: self join
  2019-04-10 09:19 self join PG Doc comments form <noreply@postgresql.org>
@ 2019-04-10 23:34 ` Euler Taveira <euler@timbira.com.br>
  0 siblings, 0 replies; 2+ messages in thread

From: Euler Taveira @ 2019-04-10 23:34 UTC (permalink / raw)
  To: francis.ebbs@gmail.com; pgsql-docs@lists.postgresql.org

Em qua, 10 de abr de 2019 às 09:23, PG Doc comments form
<noreply@postgresql.org> escreveu:
>
> The example of self join shows two resulting records.
> I have checked the input data.
> There are three output records with lower lo and higher high temperatures
>
> We seem to be missing, in the answer, a third record:
> ( (San Francisco, 46, 50) , (Hayward, 54, 37 ))
>
No, it is not. See src/tutorial/basics.source. I reproduce some
commands of that file above. Note that that self join returns only 2
records.

CREATE TABLE weather (
city varchar(80),
temp_lo int, -- low temperature
temp_hi int, -- high temperature
prcp real, -- precipitation
date date
);

CREATE TABLE cities (
name varchar(80),
location point
);

INSERT INTO weather
    VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27');

INSERT INTO cities
    VALUES ('San Francisco', '(-194.0, 53.0)');

INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)
    VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');

INSERT INTO weather (date, city, temp_hi, temp_lo)
    VALUES ('1994-11-29', 'Hayward', 54, 37);

SELECT W1.city, W1.temp_lo, W1.temp_hi,
       W2.city, W2.temp_lo, W2.temp_hi
FROM weather W1, weather W2
WHERE W1.temp_lo < W2.temp_lo
   and W1.temp_hi > W2.temp_hi;


-- 
   Euler Taveira                                   Timbira -
http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-04-10 23:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10 09:19 self join PG Doc comments form <noreply@postgresql.org>
2019-04-10 23:34 ` Euler Taveira <euler@timbira.com.br>

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