Question: Write SQL statements to answer the following questions using Assignment 4s schema (Customer-Invoice-Line-Product-Vendor 10010, Ramas, Alfred, A, 615, 8442573 10011, Dunne, Leona, K, 713, 8941238
Write SQL statements to answer the following questions using Assignment 4s schema (Customer-Invoice-Line-Product-Vendor
10010, Ramas, Alfred, A, 615, 8442573
10011, Dunne, Leona, K, 713, 8941238
10012, Smith, Kathy, W, 615, 8942285
10013, Olowski, Paul,F, 615, 2221672
10014, Orlando, Myron, NULL, 615, 2971228
invoice:
1001, 10011, 2008-08-03
1002, 10014, 2008-08-04
1003, 10012, 2008-03-20
1004, 10011, 2008-09-23
line:
1001, 12321, 1
1001, 65781, 3
1002, 34256, 6
1003, 12321, 5
1002, 12333, 6
product:
12321, hammer, 189 ,20, 232
65781, chain, 12, 45, 235
34256, tape, 35, 60, 235
12333, hanger, 200 ,10, 232
vendor:
232, Bryson, Smith, 615, 2233234
235, SuperLoo, Anderson, 615, 2158995
- For each invoice, find the total price. The total invoice price is the sum of product price* line units for each product purchased in the invoice.
- Find how many products are bought by each customer. The output should be a list of cus_code and for each cus_code, the number of products purchased by this customer. A more complex query (if you want to try it), would be to list the name of the customer, along with the cus_code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
