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, AVG(Price) AS AvgPrice
FROM Products
GROUP BY CategoryID;
B
CREATE VIEW CategoryAverages AS
SELECT *
FROM Products
GROUP BY CategoryID, AVG(Price);
C
CREATE VIEW CategoryAverages (CategoryID, AvgPrice) AS
SELECT *
FROM Products
GROUP BY CategoryID, AVG(Price);
D
CREATE VIEW CategoryAverages AS
SELECT CategoryID, Price
FROM Products
WHERE AVG(Price)>0;

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