tags:

views:

98

answers:

3

Just wondering sometime the 2NF may not be necessary.

Option 1. ORDERS {orderId (pk), custId (fk), total, date, status, ...}
   PARTS {orderId (pk), partsId (pk), qty, unitPrice, description, ...}

Option 2. ORDERS {orderId (pk), custId, total, date, status, ...}
   ORDER_PARTS {orderId (pk)(fk), partsId (pk)(fk), qty, ...}
   PARTS {partsId (pk), unitPrice, description, ...}

Most people like Option 2, I think, because it is 2NF but I think Option 1 is better because it will be simpler and faster when we query them. Why we need 2NF in cases like this?

+3  A: 

You want the 2nd normal form because with option 1, a part doesn't exist unless it belongs to an order.

Joel Coehoorn
You are right, but it is true sometimes. when we received a new order, some parts might be new to us and no record for them.
5YrsLaterDBA
+1  A: 

In Option 1, when the user wants to change the description of a part, you will have to change it on ALL the orders associated to that part. Don't you feel the bad smell?

tekBlues
You are right, too.
5YrsLaterDBA
+4  A: 

As a beginning DBA, you should be putting everything into third normal form. That means, every column in a row depends on:

  • the key (1NF).
  • the whole key (2NF).
  • nothing but the key (3NF).

With experience, you can opt to revert sometimes to 2NF for various reasons (usually speed), but that's not something I'd be worrying about as a beginner.

paxdiablo
Amen. Agreed completely. +1.
unforgiven3
+1 for the excelent brief description of the normal forms!
eKek0
"The key, the whole key, and nothing but the key, so help me Codd." :-)
marc_s