Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the following tables, write the SQL code which shows the total quantity of purchases for each raw material by each employee. Include Employee_ID, Last_Name,

Using the following tables, write the SQL code which shows the total quantity of purchases for each raw material by each employee. Include Employee_ID, Last_Name, First_Name, Raw_Material_Code, Raw_Material_Description, and the total quantity of purchases in the query.

Hint: when joining three tables, you can write:

SELECT ... FROM table1, table2, table3 WHERE table1.key1 = table2.key1 AND table1.key2 = table3.key2

or

SELECT ... FROM table1 JOIN table2 ON table1.key1 = table2.key1 JOIN table3 ON table1.key2 = table3.key2

Raw_Material Table

Attribute

Description of Attribute

Raw_Material_Code (PK)

Unique identifier for each raw material

Raw_Material_Description

Descriptive name for each raw material

Raw_Material_Price

Price of each raw material

Purchase_Order Table

Attribute

Description of Attribute

Purchase_Order_ID (PK)

Unique identifier for each purchase order

Purchase_Order_Date

Date each purchase order was placed

Employee_ID (FK)

Unique identifier for the employee who created the record

Supplier_ID (FK)

Unique identifier for each supplier

Raw_Material_Code (FK)

Unique identifier for each raw material

Quantity_Purchased

Quantity of each raw material purchased on the transaction

Raw_Material_Price

Price of each raw material

Supplier Table

Attribute

Description of Attribute

Supplier_ID (PK)

Unique identifier for each supplier

Business_Name

The name of the supplier

Supplier_Address

The physical street address of the supplier

Supplier_City

The physical city where the supplier is located

Supplier_St

The physical state where the supplier is located

Supplier_Zip

The zip code of the city where the supplier is located

Employee Table

Attribute

Description of Attribute

Employee_ID (PK)

Unique identifier for each employee

Last_Name

Last name of the employee

First_Name

First name of the employee

Email

Email address of the employee

Phone_Number

Phone number of the employee

Essay:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Using Financial Accounting Information The Alternative to Debits and Credits

Authors: Gary A. Porter, Curtis L. Norton

8th edition

1111534918, 978-1111534912

More Books

Students also viewed these Accounting questions