In SQL, use below database to create query: Retrieve a list of the raw materials
ID: 3874204 • Letter: I
Question
In SQL, use below database to create query:
Retrieve a list of the raw materials and quantities required to produce a cherry end table
(product with product description ‘cherry end table’). The query should output the material
ID, material name, material standard price, and quantity of raw material required. Sort the
results with the most expensive raw materials listed first.
FIGURE 2-22 Data model for Pine Valley Furniture Company in Microsoft Visio notation SALESPERSON TERRITOR SIN PK Salesperson ID Serves PK Territory ID Salesperson Name Salesperson Telephone Salesperson Fax Territory Name CUSTOMER PRODUCT LINE PK Customer ID PK Product Line ID Customer Name Customer Address Customer Postal Code Product Line Name Submits Includes ORDER PK Order ID Order Date DUC ORDER LINE PK Product ID Product Description Product Finish Product Standard Price Ordered Quantity VENDOR USES PRODUCED IN PK Vendor ID Vendor Name Vendor Address Goes Into Quantity RAW MATERIAL WORK CENTER PK Material ID PK Work Center ID Material Name Material Standard Cost Unit Of Measure Work Center Location Supply Unit Price ls Supervised By EMPLOYEE WORKS IN SupervisesPEmployee ID HAS SKILL SKILL Employee Name Employee Address PK SkillExplanation / Answer
The tables used will RAW MATERIAL, USES and PRODUCT.
The first join between RAW MATERIAL and USES gives the material with corresponding quantity.
the next join between USES and PRODUCT gives the corresponding Products and applying filter on Product Description = 'cherry end table' gives us the desired result.
Finally apply descending order on Material Standard Cost
Select RW.[Material Id], RW.[Material Name], RW.[Material Standard Cost],
US.[Goes Into Quantity]
FROM [RAW MATERIAL] RW
INNER JOIN
[USES] US
ON RW.[Material ID] = US.[Material ID]
INNER JOIN [PRODUCT] PR
ON PR.[Product ID] = US.[Product ID]
AND PR.[Product Description] = 'cherry end table’
ORDER BY RW.[Material Standard Cost] DESC
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.