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 />

One-to-One or Many<br />

This is one form of your run-of-the-mill, average, everyday foreign key kind of relationship. Usually, this<br />

is found in some form of header/detail relationship. A great example of this would be our Orders situation,<br />

as shown in Figure 8-3. OrderDetails (the one or many side of the relationship) doesn’t make<br />

much sense without an Orders header to belong to (does it do you much good to have an order for a<br />

part if you don’t know who the order is for?). Likewise, it doesn’t make much sense to have an order if<br />

there wasn’t anything actually ordered (for example, “Gee, look, ACME company ordered absolutely<br />

nothing yesterday.”).<br />

Figure 8-3<br />

Order No(PK) Line Item(PK) Part No Qty Unit Price Total Price<br />

100<br />

100<br />

100<br />

100<br />

101<br />

102<br />

102<br />

102<br />

103<br />

103<br />

103<br />

Order No(PK) Order Date Customer No<br />

1<br />

2<br />

3<br />

4<br />

1<br />

1<br />

2<br />

3<br />

1<br />

2<br />

3<br />

100<br />

101<br />

102<br />

103<br />

1/1/1999<br />

1/1/1999<br />

1/1/1999<br />

1/1/1999<br />

1A4536<br />

0R2400<br />

0R2403<br />

4I5436<br />

3X9567<br />

8G9200<br />

8G5437<br />

3H6250<br />

8G9200<br />

2P5523<br />

3X9567<br />

5<br />

4<br />

4<br />

1<br />

1<br />

7<br />

1<br />

1<br />

40<br />

1<br />

1<br />

54545<br />

12000<br />

66651<br />

54545<br />

15<br />

27<br />

29<br />

750<br />

62.50<br />

12<br />

15<br />

32<br />

12<br />

165<br />

42<br />

75<br />

108<br />

116<br />

750<br />

62.50<br />

84<br />

15<br />

32<br />

480<br />

165<br />

42<br />

229

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

Saved successfully!

Ooh no, something went wrong!