Re: Add a new row based on the condition?

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: Tue, 3 Jun 2008 09:39:19 -0700 (PDT)
Message-ID: <5750e0ff-2437-42cd-be12-59dc22bab049@s50g2000hsb.googlegroups.com>


On Jun 3, 4:11 am, iher..._at_gmail.com wrote:
> Hello,
>
> I have designed two tables, one for the main information of
> maintenance, and the other for additional information. The additional
> table is used when one column in the main table has the value of 1
> meaning we will send it to other company to repair it. So in the
> additional table we have to record the company name, address, and
> delivery package number, etc. If we can do it ourself, there is then
> no need to use the additional table.
>
> I have been thinking about this approach. Is this the right way? I
> think it might cause the inconsistency of the database and difficulty
> to  maintain the database. But I wonder if there is any alternatives.
> Any suggests? Thank you a lot.

Having a repair vendor information table could well be the right way to handle this but the answer depends on a lot of factors not included in your post.

Follow the rules of normalization. Make sure each table is a collection of data about a specific entity and that every column associated directly to the PK value of the entity is part of the table. Any information dependend on just one column other than the PK column or dependent on only one column of a multi-column PK belongs in a different table.

If you have questions on your design then go over it asking yourself why you included the column, what relationship the column has to the PK, and what relationship each column has to every other column in the table.

Be open to the possibility that your attributes could be organized into a different collection of entities and hence tables.

HTH -- Mark D Powell -- Received on Tue Jun 03 2008 - 11:39:19 CDT

Original text of this message