Question: For every invoice, display the invoice number, invoice date and the total dollar amount for all products purchased in the invoice, ordered by invoice number

For every invoice, display the invoice number, invoice date and the total dollar amount for all products purchased in the invoice, ordered by invoice number in descending order. Here you will use an aggregate SUM(x*y) function in your SELECT clause to calculate the total dollar amount (a calculated field name it with the alias TOTAL).
CUSTOMER TABLE
CUS_CODE CUS_LNAME CUS_FNAME CUS_INITIAL CUS_AREACODE CUS_PHONE CUS_BALANCE
10010 Ramas Alfred A 615844-25730
10011 Dunne Leona K 713894-12380
10012 Smith Kathy W 615894-2285345.86
10013 Olowski Paul F 615894-2180536.75
10014 Orlando Myron -615222-16720
10015 O'Brian Amy B 713442-33810
10016 Brown James G 615297-1228221.19
10017 Williams George -615290-2556768.93
10018 Farriss Anne G 713382-7185216.55
10019 Smith Olivette K 615297-38090
INVOICE
INV_NUMBER CUS_CODE INV_DATE
10011001416-JAN-2022
10021001116-JAN-2022
10031001216-JAN-2022
10041001117-JAN-2022
10051001817-JAN-2022
10061001417-JAN-2022
10071001517-JAN-2022
10081001117-JAN-2022
LINE
INV_NUMBER LINE_NUMBER P_CODE LINE_UNITS LINE_PRICE
1001113-Q2/P2114.99
1001223109-HB 19.95
1002154778-2T 24.99
100312238/QPD 138.95
100321546-QQ2139.95
1003313-Q2/P2514.99
1004154778-2T 34.99
1004223109-HB 29.95
10051 PVC23DRT 125.87
10061 SM-1827736.99
100622232/QTY 1109.92
1006323109-HB 19.95
1006489-WRE-Q 1256.99
1007113-Q2/P2214.99
1007254778-2T 14.99
10081 PVC23DRT 55.87
10082 WR3/TT33119.95
1008323109-HB 19.95
PRODUCT
P_CODE P_DESCRIPT P_INDATE P_QOH P_MIN P_PRICE P_DISCOUNT V_CODE
11QER/31 Power painter, 15 psi., 3-nozzle 03-NOV-202185109.99025595
13-Q2/P27.25 in. pwr. saw blade 13-DEC-2021321514.99.0521344
14-Q1/L39.00-in. pwr. saw blade 13-NOV-2021181217.49021344
1546-QQ2 Hrd. cloth, 14-in.,2x5015-JAN-202215839.95023119
1558-QW1 Hrd. cloth, 12-in.,3x5015-JAN-202223543.99023119
2232/QTY BD jigsaw, 12-in. blade 30-DEC-202185109.92.0524288
2232/QWE BD jigsaw, 8-in. blade 24-DEC-20216599.87.0524288
2238/QPD BD cordless drill, 12-in.20-JAN-202212538.95.0525595
23109-HB Claw hammer 20-JAN-202223109.95.121225
23114-AA Sledge hammer, 12 lb.02-JAN-20228514.4.05-
54778-2T Rat-tail file, 18-in. fine 15-DEC-202143204.99021344
89-WRE-Q Hicut chain saw, 16 in.07-FEB-2022115256.99.0524288
PVC23DRT PVC pipe, 3.5-in.,8-ft 20-FEB-2022188755.870-
SM-182771.25-in. metal screw, 2501-MAR-2022172756.99021225
SW-231162.5-in. wd. screw, 5024-FEB-20222371008.45021231
WR3/TT3 Steel, 4x8x16,.5 mesh 17-JAN-2022185119.95.125595
 For every invoice, display the invoice number, invoice date and the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!