Re: Table Join Question

From: Joe Celko <71062.1056_at_compuserve.com>
Date: Tue, 22 Aug 2000 23:13:08 GMT
Message-ID: <8nv1dl$mga$1_at_nnrp1.deja.com>


>> But I have inherited a huge 60+ table legacy schema, where I could
do the joins either way. If it were the case, does your post imply I should always join back to the table which has the primary key? <<

Can you clean up the schema? It will never work right if you cannot normalize to at least 3NF. The general ansswer is to use the PRIMARY KEY because it is what uniquely identifies the entity. Anything else is a secondary reference. And it will run faster becaue of indexes, as Heinz already said.

--CELKO--
Joe Celko, SQL and Database Consultant
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which can be cut and pasted into Query Analyzer is appreciated.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Aug 23 2000 - 01:13:08 CEST

Original text of this message