Project 4

Table One, containg the primary key

ID
Last_Name
First_Name
Total
1
Capobianco Anthony
279.99
2
Fonk Vern
195.37
3
Bob Billy
319.34
4
Slakowski Mike
63.49
5
Yates Virgil
389.00
6
Zugschwert Sarah
169.83

Table two, containing the foreign key

ID
Description
Quantity
Price
1
Pioneer 16x DVD Rom Drive
1
79.99
4
24" Rounded IDE Cable
3
18.50
2
16x10x40 CD-RW
1
195.37
3
17" Monitor
2
159.67
4
Copper Shim
1
7.99
6
650W Enermax PS
1
169.89
5
LeadTek GeFroce 3 64MB
1
389.00
1
SB Live 5.1
1
199.99
These two tables contain information that relate to each other through the ID column. The table on the left contains the primary key of users who have made purchases. There are two columns stating the users name. The last column shows the total purchased dollars made by each particular person.

The table on the right contains the foreign keys, these have the same information in the ID column. The description column describes what product was purchased. The quantity column displays how much or a particular product was purchased. The last column displays the product price.

Execute Query


Start with opening a connection to the databse. Retrieve all relevant columns, in this case we retrieve all columns. Then being the query posed by the user.

1.) Anthony asks, "How much have I purchased?"
Answer: 279.99

2.) Mike asks, "What have I purchased?"
Answer: Three 24" round IDE cables and one copper shim.