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. In the SQL Query do the following Select clause: CUS_CODE, INV_NUMBER, P_DESCRIPT, LINE_UNITS AS “Units Bought”, LINE_PRICE as “Unit Price”, derived attribute Subtotal using the formula stated above From: Join conditions between these tables INVOICE, LINE, PRODUCT Where clause: You can put join conditions here as well if you do not want to put them in the from clause. There are many ways to write the query. Order by clause: use the columns as stated in the problem description.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

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. 

In the SQL Query do the following 

Select clause: CUS_CODE, INV_NUMBER, P_DESCRIPT, LINE_UNITS AS “Units  Bought”, LINE_PRICE as “Unit Price”, derived attribute Subtotal using the formula  stated above 

From: Join conditions between these tables INVOICE, LINE, PRODUCT 

Where clause: You can put join conditions here as well if you do not want to put them in the from clause. There are many ways to write the query. 

Order by clause: use the columns as stated in the problem description.

Cus.CODE
INV NUMBER
P DESCRIPT
Units Bought
Unit Price
Subtotal
10011
1002
Rat-tail file, 1/8-in. fine
2.00
4.99
9.98
10011
1004
Claw hammer
2.00
9.95
19.90
10011
1004
Rat-tail file, 1/8-in. fine
3.00
4.99
14.97
10011
1008
Claw hammer
1.00
9.95
9.95
10011
1008
PVC pipe, 3.5-in, 8-ft
5.00
5.87
29.35
Steel matting, 4x8x1/6", 5" mesh
10011
1008
3.00
119.95
359.85
10012
1003
7.25-in. pwr. saw blade
5.00
14.99
74.95
B&D cordless drill, 1/2-in.
10012
1003
1.00
38.95
38.95
10012
1003
Hrd. cloth, 1/4-in, 2:50
1.00
39.95
39.95
10014
1001
7.25-in. pwr. saw blade
1.00
14.99
14.99
Figure P7.12
Transcribed Image Text:Cus.CODE INV NUMBER P DESCRIPT Units Bought Unit Price Subtotal 10011 1002 Rat-tail file, 1/8-in. fine 2.00 4.99 9.98 10011 1004 Claw hammer 2.00 9.95 19.90 10011 1004 Rat-tail file, 1/8-in. fine 3.00 4.99 14.97 10011 1008 Claw hammer 1.00 9.95 9.95 10011 1008 PVC pipe, 3.5-in, 8-ft 5.00 5.87 29.35 Steel matting, 4x8x1/6", 5" mesh 10011 1008 3.00 119.95 359.85 10012 1003 7.25-in. pwr. saw blade 5.00 14.99 74.95 B&D cordless drill, 1/2-in. 10012 1003 1.00 38.95 38.95 10012 1003 Hrd. cloth, 1/4-in, 2:50 1.00 39.95 39.95 10014 1001 7.25-in. pwr. saw blade 1.00 14.99 14.99 Figure P7.12
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education