MySQL Forums
Forum List  »  Newbie

Re: Database Normalization: Always the best thing to do?
Posted by: laptop alias
Date: June 30, 2009 03:19AM

1.

The rules of 1NF state, inter alia, that there should be no duplicates, and that 'cells' should contain just one value from their applicable domain.

Your design can step away from this normal form, it's just that it's no longer a database.

2. Is this what you mean?
product
product_id,product_name
1         ,tshirt
2         ,shorts
3         ,sweatshirt

colour
colour_id,colour
1        ,red
2        ,orange
3        ,yellow

product_colour
product_id colour_id
1          1
1          3
2          2
2          2

SELECT p.product_name
     , c.colour 
  FROM product p
  LEFT
  JOIN product_colour pc
    ON pc.product_id = p.product_id
  LEFT
  JOIN colour c
    ON c.colour_id = pc.colour_id;

Options: ReplyQuote


Subject
Written By
Posted
Re: Database Normalization: Always the best thing to do?
June 30, 2009 03:19AM


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.