Question: Write a query to display the customer code, balance, and total purchases for each customer. Total purchase is calculated by summing the line subtotals (as

Write a query to display the customer code, balance, and total purchases for each customer. Total purchase is calculated by summing the line subtotals (as calculated in Problem 12) for each customer. Sort the results by customer code, and use aliases as shown in Figure P7.13. 

Figure P7.13 Customer Purchase Summary CUS_CODE CUS_BALANCE Total Purchases 10011 444.00 10012 153.85 10014


Data in Problem 12

Using the output shown in Figure P7.12 as your guide, generate a list of customer purchases, including the subtotals for each of the invoice line numbers. The subtotal is a derived attribute calculated by multiplying LINE_UNITS by LINE_PRICE. Sort the output by customer code, invoice number, and product description. Be certain to use the column aliases as shown in the figure.

Figure P7.12 Summary of Customer Purchases with Subtotals CUS_CODE INV_NUMBER 10011 10011 10011 10011 10011

Figure P7.13 Customer Purchase Summary CUS_CODE CUS_BALANCE Total Purchases 10011 444.00 10012 153.85 10014 422.77 10015 10018 0.00 345.86 0.00 0.00 216.55 34.97 70.44

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The below query generates a listing of customer purchases SELECT CUSCODEINVNUMBERPDESCRIPTUNITSBO... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Database Systems Design Implementation Questions!