MySQL Forums
Forum List  »  Newbie

Re: Database Normalization: Always the best thing to do?
Posted by: Dude Abides
Date: June 30, 2009 07:48PM

I set up the sample tables and used your query and it worked like a charm, thanks again!

I had one more simple question for you or anyone else who wants a shot at it. In my real database, there are multiple columns in the products table that references the same colors table. So it would be kind of like having a primary_colors column, secondary_colors column, and highlight_color column (for example).

I tried it where the product_colors has an extra column (I called it key) that tells it if it's primary, secondary, or highlight. It works great this way by simply adding:
JOIN product_color pc ON pc.product_id = p.product_id
AND key = "primary"

Is this considered proper normalization still? In my real database, about 6 columns in the products will reference the colors directly. It seems more logical then having 6 different tables tying two of the same tables together.

I was also going to ask if one of those 6 columns could only have one color, could it be kept in the products table? At this point it seems to make the most sense to just put them all into the products_color table.

Thanks again for your help! Much appreciated!

Options: ReplyQuote


Subject
Written By
Posted
Re: Database Normalization: Always the best thing to do?
June 30, 2009 07:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.