Question: 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

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 Accounting Questions!