Proper Join and check

From: Patrick Nelson <pnelson(at)neatech(dot)com>
To: "PostgreSQL List (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Proper Join and check
Date: 2002-10-06 05:45:00
Message-ID: 4165C48DE9A0D211B6400800095C585F172E67@WASHINGTON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If I have a one to many relation set on sym in each table is like... say
this:

CREATE TABLE "tableone" (
"sym" varchar(5) NOT NULL,
PRIMARY KEY ("sym") );

and

CREATE TABLE "tablemany" (
"id" int4 NOT NULL DEFAULT nextval('res_id_seq'::text),
"sym" varchar(5) REFERENCES tableone ON UPDATE CASCADE,
PRIMARY KEY ("id") );

Now these tables hold a lot of data so I want to do this correctly. How do
I find the records in tableone that don't have any corresponding records in
tablemany? In my application this shouldn't happen accept during the
initial inserting in tableone which briefly is followed by inserting in
tablemany.

Browse pgsql-general by date

  From Date Subject
Next Message Billy G. Allie 2002-10-06 07:43:53 Re: Proper Join and check
Previous Message Oleg Bartunov 2002-10-06 04:06:03 Re: multi-column btree index for real values