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 --
The question becomes, will there be one and only one other company
with only one address forever and ever until the end of time? If not,
you probably want to store a foreign key rather than "1."
I know one person companies who have more than one shipping address.
I work on enterprise software that prepends a company identifier to
most everything.
I also know companies that try to fix things themselves, then ship it
out if they can't. I also know a company that has mobile mechanics
they send to people who've screwed up trying to fix their cars... so,
it depends. See Mark's answer.
jg
--
@home.com is bogus.
$10M worth of contrition: http://www.signonsandiego.com/uniontrib/20080603/news_1b3weiss.html
word: zomel