dbTalk Databases Forums  

design question

comp.databases.theory comp.databases.theory


Discuss design question in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
robur.6@gmail.com
 
Posts: n/a

Default design question - 10-15-2008 , 06:48 AM






I would appreciate your advice about the design of the following
schema:
We have a database of products and we know that:
- a product is of a certain type
- a product has several parts
- a product part can belong only to products of some specific type

So we end up with:

products {product, product_type, ...}
key: {product}

part_types {product_type, part_type, ...}
key: {product_type, part_type}

product_parts {product, part, product_type, part_type, ...}
key: {product, part}
foreign keys: products {product, product_type}, part_types
{product_type, part_type}


The problem is the “product_type” attribute in relation “products”.
While redundant because it was already stated that the product is of a
certain type in the “products” relation, it is required as part of the
foreign key to “part_types”. Still anomalies are avoided due the
foreign key to “products relation” (not to the primary key but to a
superkey).

The obvious solution is removal of “product_type” from “product_parts
“ and addition of a constraint to check if a product type can be
associated with a certain part type. However it is more difficult to
implement in a SQL database than a foreign key.

The design looks awkward, it is more complicated, adds a lot of
redundant information, but it makes easy to enforce some constraints
that would need to be implemented using triggers (this is actually a
simplified version of the schema, in the real database there are more
tables that are using overlapping foreign key to “products” table).

What do you think as being more important, sticking to normalization
rules or choosing a compromise that will add some redundant data but
under a strict control using foreign keys? Can you spot advantages/
disadvantages of each variant? Or perhaps you could suggest a better
solution…

Thank you for your time


Reply With Quote
  #2  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM






Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #3  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #4  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #5  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #6  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #7  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #8  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #9  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
  #10  
Old   
-CELKO-
 
Posts: n/a

Default Re: design question - 10-15-2008 , 01:39 PM



Have you looked at the nested sets model for parts explosions? This
lets you keep the hierarchy in one table and the nodes in another
table. This can go to any depth, etc. And it is fully normalized
and has no redundancy. Get a copy of TREES & HIERARCHIES IN SQL for
details.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.