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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

232<br />

Figure 8-5<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 />

1A4536<br />

0R2400<br />

0R2403<br />

4I5436<br />

3X9567<br />

8G9200<br />

8G5437<br />

3H6250<br />

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

By using the join syntax that we learned back in Chapter 4, we can relate one product to the many orders<br />

that it’s been part of, or we can go the other way and relate an order to all the products on that order.<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 />

Part No (PK) Description wt<br />

Flange<br />

Injector<br />

Injector<br />

Head<br />

Pump<br />

Fan<br />

Fan<br />

Control<br />

Housing<br />

15<br />

27<br />

29<br />

750<br />

62.50<br />

12<br />

15<br />

32<br />

12<br />

165<br />

42<br />

6<br />

.5<br />

.5<br />

3<br />

5<br />

3<br />

3<br />

5<br />

1<br />

75<br />

108<br />

116<br />

750<br />

62.50<br />

84<br />

15<br />

32<br />

480<br />

165<br />

42

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

Saved successfully!

Ooh no, something went wrong!