You are here: Re: How to normalize these relationships? « MsSQL Server « IT news, forums, messages
Re: How to normalize these relationships?

Posted by Erland Sommarskog on 03/04/07 10:19

(bbcrock@gmail.com) writes:
> I have three tables with a relationship I've never worked with
> before. Can anyone suggest/comment on the best way to create a third
> normal form relationship between these tables?
>
> The tables basically are:
>
> TRAIN (TRAIN_ID and 15 columns about train specs, etc)
> TRUCK (TRUCK_ID and 12 columns about truck specs, etc)
> TRANSPORTATION_ITEM
> This table has, among others, two columns, TRUCK_ID and TRAIN_ID. If
> the truck column is used there can be no data in the train column and
> vice versa.
>
> This relationship seems denormalized to me, but I don't remember how
> to normalize it. Does anyone know the correct name for this kind of
> relationship?

It's difficult to say exactly from this scant information. Judging from
the anme, TRANSPORTATION_ITEM is a supercalls, of which TRAIN and TRUCH
are heirs, to speak in object-orirent terms. In such case, it feels
backwards to me that TRUCK_ID and TRAIN_ID appears in TRANSPORTATION_ITEM.
I'd rather have a TRANSPORTATION_ITEM_ID that also would be the key in
thr TRAIN and TRUCK tables.

But the purpose of TRANSPORTATION_ITEM may be different, in which case
TRAIN_ID and TRUCK_ID as mutually exclusive columns makes perfect sense.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация