nerdexam
Microsoft

70-433 · Question #125

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…

The correct answer is C. SELECT Color, (COUNT(*) * 1.0)/ COUNT(*) OVER() AS PercentColor. See the full explanation below for the reasoning.

Question

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?

Options

  • ASELECT Color
  • BSELECT Color
  • CSELECT Color, (COUNT() * 1.0)/ COUNT() OVER() AS PercentColor
  • DSELECT Color, COUNT() * 1.0) / COUNT() OVER(PARTITION BY Color)

How the community answered

(42 responses)
  • A
    7% (3)
  • B
    5% (2)
  • C
    74% (31)
  • D
    14% (6)

Community Discussion

No community discussion yet for this question.

Full 70-433 Practice