You have a table named Products. The table contains a column named Color.
You need to write a Transact-SQL statement that calculates the percentage of products of each product color.
Which Transact-SQL statement should you use?
A.
SELECT Color COUNT(*) OVER(PARTITION BY Color)
/ (COUNT(*) * 1.0) AS PercentColor FROM Products GROUP BY Color;
B.
SELECT Color COUNT(*) OVER() / (COUNT(*) * 1.0) AS PercentColor
/ (COUNT(*) * 1.0) AS PercentColor FROM Products GROUP BY Color;
C.
SELECT Color, (COUNT(*) * 1.0)/ COUNT(*) OVER() AS PercentColor FROM Products GROUP BY Color;
D.
SELECT Color, COUNT(*) * 1.0) / COUNT(*) OVER(PARTITION BY Color) AS PercentColor FROM Products GROUP BY Color;