MANAGMENT INFORMATION SYSTEMS IS THE SUBJECT. I have this SQL statement using JO
ID: 3714673 • Letter: M
Question
MANAGMENT INFORMATION SYSTEMS IS THE SUBJECT. I have this SQL statement using JOIN from two different tables. I'm supposed to write it again using SUBQUERY. Here is my SQL using JOIN.
SELECT Avg(Inventory.SellingPrice) AS AvgOfSellingPrice, Supplier.SupplierName
FROM Supplier INNER JOIN Inventory ON Supplier.SupplierCode = Inventory.SupplierCode
GROUP BY Supplier.SupplierName
HAVING Supplier.SupplierName='Logo Goods';
Please write this same SQL statement but use SUBQUERY instead of JOIN. (display the average selling price of supplier Logo Goods. )
Explanation / Answer
Please find below the required query needed. This query is using the subquery instead of joins.
Query :
SELECT Avg(SellingPrice) AS AvgOfSellingPrice
FROM Inventory
WHERE SupplierCode IN
(
SELECT SupplierCode FROM Supplier
WHERE SupplierName='Logo Goods'
)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.