exclusion query - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject exclusion query
Date
Msg-id 20080922143414.GA1983@apartia.fr
Whole thread Raw
Responses Re: exclusion query
Re: exclusion query
List pgsql-sql
Hi,

I've got five related tables:

- person_type:id_person_type     integertype_fr            text

- person:id_person         integer...

- person_to_event:id_person         -> personid_person_type     -> person_type (e.g: actor, director, producer,
...)id_event       -> event
 

- event:id_event        integerid_event_type    -> event_type...

- event_type:id_event_type    integertype_fr            text

To select person_type's used in a certain event_type I have this query:

select distinct pt.type        from person_type pt        natural join person_to_event        join event e using
(id_event)       natural join event_type et        where et.type_fr='théâtre';
 

Now, I'd like to select person_type's _not_ used in a certain particular
event (say id_event=219).

I can see how to build a quey to that effect, but is there a more
obvious, clean, short solution? Something that looks like the above
query maybe?

Thanks,


pgsql-sql by date:

Previous
From: "Marc Mamin"
Date:
Subject: varchar::timezone conversion
Next
From: Louis-David Mitterrand
Date:
Subject: Re: exclusion query