17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8: Being Normal: Normalization and Other Basic Design Issues<br />

PartNo (PK) Description Wt<br />

4I5436 Head 3<br />

3X9567 Pump 5<br />

8G9200 Fan 3<br />

8G5437 Fan 3<br />

3H6250 Control 5<br />

8G9200 Fan 3<br />

2P5523 Housing 1<br />

3X9567 Pump 5<br />

You can then chop all but the foreign key out of the OrderDetails table:<br />

OrderNo (PK) LineItem (PK) PartNo Qty Unit Price Total Price<br />

100 1 1A4536 5 15 75<br />

100 2 OR2400 4 27 108<br />

100 3 OR2403 4 29 116<br />

100 4 4I5436 1 750 750<br />

101 1 3X9567 1 62.50 62.50<br />

102 1 8G9200 7 12 84<br />

102 2 8G5437 1 15 15<br />

102 3 3H6250 1 32 32<br />

103 1 8G9200 40 12 480<br />

103 2 2P5523 1 165 165<br />

103 3 3X9567 1 42 42<br />

That takes care of problem number 1 (cross-column dependency), but doesn’t deal with derived data.<br />

We have a column called TotalPrice that contains data that can actually be derived from multiplying<br />

Qty by UnitPrice. This is a no-no in normalization.<br />

225

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!