Question: Scenario: In a database with a Products table containing columns ProductID, CategoryID, and Price, which SQL query would create a view named CategoryAverages to retrieve
Scenario: In a database with a Products table containing columns ProductID, CategoryID, and Price, which SQL query would create a view named CategoryAverages to retrieve the average price for each product category?
Context:
Products Table Columns:
ProductID
CategoryID
Price
A
CREATE VIEW CategoryAverages AS
SELECT CategoryID, AVGPrice AS AvgPrice
FROM Products
GROUP BY CategoryID;
B
CREATE VIEW CategoryAverages AS
SELECT
FROM Products
GROUP BY CategoryID, AVGPrice;
C
CREATE VIEW CategoryAverages CategoryID AvgPrice AS
SELECT
FROM Products
GROUP BY CategoryID, AVGPrice;
D
CREATE VIEW CategoryAverages AS
SELECT CategoryID, Price
FROM Products
WHERE AVGPrice;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
