pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedNo DIVIDE Operator
6+ messages / 3 participants
[nested] [flat]
* No DIVIDE Operator
@ 1999-05-03 13:25 Joerg Fischer <fischer@zkm.de>
1999-05-03 14:16 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
0 siblings, 1 reply; 6+ messages in thread
From: Joerg Fischer @ 1999-05-03 13:25 UTC (permalink / raw)
To: pgsql-sql
Hi!
Consider the following szenario:
Two Tables:
create table Person (
name text,
prename text,
street text,
town text
);
create table Officer (
name text,
prename text,
bureau text
);
So, every Officer is a Person. Now, I would like to get all persons
except for Officers.
If there would be a divide operator, I could write
select name, prename from Person divide select name, prename from
Officer;
without it, however, things get really complicated:
select name, prename from Person where prename not in ( select prename
from Officer where Officer.name = Person.name );
This is an easy example. However, I have to deal with about 10 tables in
a corresponding way.
Any better idea? Will there be a divide operator in PGSQL soon?
Thanks!
Regards
Joerg Fischer
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] No DIVIDE Operator
1999-05-03 13:25 No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
@ 1999-05-03 14:16 ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 14:35 ` Re: [SQL] No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
0 siblings, 1 reply; 6+ messages in thread
From: Chris Bitmead @ 1999-05-03 14:16 UTC (permalink / raw)
To: pgsql-sql
Isn't that what EXCEPT does?
chris=> create table foo (text text);
CREATE
chris=> insert into foo values('aaa');
INSERT 22153 1
chris=> insert into foo values('bbb');
INSERT 22154 1
chris=> insert into foo values('ccc');
INSERT 22155 1
chris=> select * from foo EXCEPT select 'aaa';
text
----
bbb
ccc
(2 rows)
> If there would be a divide operator, I could write
>
> select name, prename from Person divide select name, prename from
> Officer;
>
> without it, however, things get really complicated:
>
> select name, prename from Person where prename not in ( select prename
> from Officer where Officer.name = Person.name );
>
> This is an easy example. However, I have to deal with about 10 tables in
> a corresponding way.
>
> Any better idea? Will there be a divide operator in PGSQL soon?
>
> Thanks!
>
> Regards
>
> Joerg Fischer
--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] No DIVIDE Operator
1999-05-03 13:25 No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 14:16 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
@ 1999-05-03 14:35 ` Joerg Fischer <fischer@zkm.de>
1999-05-03 15:02 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
0 siblings, 1 reply; 6+ messages in thread
From: Joerg Fischer @ 1999-05-03 14:35 UTC (permalink / raw)
To: Chris Bitmead <chris.bitmead@bigfoot.com>; +Cc: pgsql-sql
Chris Bitmead wrote:
>
> Isn't that what EXCEPT does?
Maybe the operator is named differently between different database
systems. Anyway, as far as I am concerned, PGSQL lacks it. Or
(hopefully), am I wrong??
Regards
Joerg Fischer
> chris=> create table foo (text text);
> CREATE
> chris=> insert into foo values('aaa');
> INSERT 22153 1
> chris=> insert into foo values('bbb');
> INSERT 22154 1
> chris=> insert into foo values('ccc');
> INSERT 22155 1
> chris=> select * from foo EXCEPT select 'aaa';
> text
> ----
> bbb
> ccc
> (2 rows)
>
> > If there would be a divide operator, I could write
> >
> > select name, prename from Person divide select name, prename from
> > Officer;
> >
> > without it, however, things get really complicated:
> >
> > select name, prename from Person where prename not in ( select prename
> > from Officer where Officer.name = Person.name );
> >
> > This is an easy example. However, I have to deal with about 10 tables in
> > a corresponding way.
> >
> > Any better idea? Will there be a divide operator in PGSQL soon?
> >
> > Thanks!
> >
> > Regards
> >
> > Joerg Fischer
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] No DIVIDE Operator
1999-05-03 13:25 No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 14:16 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 14:35 ` Re: [SQL] No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
@ 1999-05-03 15:02 ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 16:19 ` Re: [SQL] No DIVIDE Operator Bruce Momjian <maillist@candle.pha.pa.us>
1999-05-05 05:35 ` Re: [SQL] No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
0 siblings, 2 replies; 6+ messages in thread
From: Chris Bitmead @ 1999-05-03 15:02 UTC (permalink / raw)
To: pgsql-sql
Joerg Fischer wrote:
>
> Chris Bitmead wrote:
> >
> > Isn't that what EXCEPT does?
>
> Maybe the operator is named differently between different database
> systems. Anyway, as far as I am concerned, PGSQL lacks it. Or
> (hopefully), am I wrong??
Well Postgres has EXCEPT. Is that what you want?
>
> Regards
>
> Joerg Fischer
>
> > chris=> create table foo (text text);
> > CREATE
> > chris=> insert into foo values('aaa');
> > INSERT 22153 1
> > chris=> insert into foo values('bbb');
> > INSERT 22154 1
> > chris=> insert into foo values('ccc');
> > INSERT 22155 1
> > chris=> select * from foo EXCEPT select 'aaa';
> > text
> > ----
> > bbb
> > ccc
> > (2 rows)
> >
> > > If there would be a divide operator, I could write
> > >
> > > select name, prename from Person divide select name, prename from
> > > Officer;
> > >
> > > without it, however, things get really complicated:
> > >
> > > select name, prename from Person where prename not in ( select prename
> > > from Officer where Officer.name = Person.name );
> > >
> > > This is an easy example. However, I have to deal with about 10 tables in
> > > a corresponding way.
> > >
> > > Any better idea? Will there be a divide operator in PGSQL soon?
> > >
> > > Thanks!
> > >
> > > Regards
> > >
> > > Joerg Fischer
--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] No DIVIDE Operator
1999-05-03 13:25 No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 14:16 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 14:35 ` Re: [SQL] No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 15:02 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
@ 1999-05-03 16:19 ` Bruce Momjian <maillist@candle.pha.pa.us>
1 sibling, 0 replies; 6+ messages in thread
From: Bruce Momjian @ 1999-05-03 16:19 UTC (permalink / raw)
To: Chris Bitmead <chris.bitmead@bigfoot.com>; +Cc: pgsql-sql
> Joerg Fischer wrote:
> >
> > Chris Bitmead wrote:
> > >
> > > Isn't that what EXCEPT does?
> >
> > Maybe the operator is named differently between different database
> > systems. Anyway, as far as I am concerned, PGSQL lacks it. Or
> > (hopefully), am I wrong??
>
> Well Postgres has EXCEPT. Is that what you want?
I think we only got EXCEPT in 6.5 beta, so he may not have it yet.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] No DIVIDE Operator
1999-05-03 13:25 No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 14:16 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 14:35 ` Re: [SQL] No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 15:02 ` Re: [SQL] No DIVIDE Operator Chris Bitmead <chris.bitmead@bigfoot.com>
@ 1999-05-05 05:35 ` Joerg Fischer <fischer@zkm.de>
1 sibling, 0 replies; 6+ messages in thread
From: Joerg Fischer @ 1999-05-05 05:35 UTC (permalink / raw)
To: Chris Bitmead <chris.bitmead@bigfoot.com>; +Cc: pgsql-sql
Chris Bitmead wrote:
>
> Joerg Fischer wrote:
> >
> > Chris Bitmead wrote:
> > >
> > > Isn't that what EXCEPT does?
> > Maybe the operator is named differently between different database
> > systems. Anyway, as far as I am concerned, PGSQL lacks it. Or
> > (hopefully), am I wrong??
>
> Well Postgres has EXCEPT. Is that what you want?
AFAIK, EXCEPT is included in version 6.5beta1. Monday, I installed that
one. Now it works! Great! Thanks!
Regards
Joerg Fischer
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~1999-05-05 05:35 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-05-03 13:25 No DIVIDE Operator Joerg Fischer <fischer@zkm.de>
1999-05-03 14:16 ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 14:35 ` Joerg Fischer <fischer@zkm.de>
1999-05-03 15:02 ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-03 16:19 ` Bruce Momjian <maillist@candle.pha.pa.us>
1999-05-05 05:35 ` Joerg Fischer <fischer@zkm.de>
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