Query regarding Intersect clause - Mailing list pgsql-general

From Ajit Pradnyavant
Subject Query regarding Intersect clause
Date
Msg-id CAFu=Yd_UmEn0WXZZkwgsj6hyp5mq452xX-uDqGvg7yAeq0OvKg@mail.gmail.com
Whole thread Raw
Responses Re: Query regarding Intersect clause
List pgsql-general
Sir,

I have created the following tables,

Create table abc (srno int, name varchar(32))
Create table def (srno int, name varchar(32))

    abc
srno    name
1    Aaaa
2    Bbbb

    def
srno    name
1    Aaaa
2    Cccc

each having two tuples.

If I run the following query I get the following result.
(Select name from abc) intersect (select name from def)

Srno    Name
1    Aaaa

If I run the following query I get the following result.
(Select name from abc) intersect all (select name from def)

Srno    Name
1    Aaaa

I think result of INTERSECT ALL query may be :

Srno    Name
1    Aaaa
1    Aaaa

Because  intersect all clause returns the duplicate values.
Please tell me I am wrong or correct.

Thank you in anticipation.

--
Sincerely,
Ajit Pradnyavant.
Email:- ajit.pradnyavant@gmail.com
Phone No. 7385758326

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Slow queries when functions are inlined
Next
From: Evan Martin
Date:
Subject: Re: Slow queries when functions are inlined