LikeLike

]]>LikeLike

]]>I think you have the wrong picture before this text : “Our result set shows no ratios and all 0’s.”

Thank you for all the extremely useful content.

Cheers, Spyros

LikeLike

]]>LikeLike

]]>LikeLike

]]>SELECT DISTINCT Category,

COUNT(*) OVER (PARTITION BY Category)*100.0/ COUNT(*) OVER() as PctCategory

FROM CurrentProducts

Thanks,

Wayne (USA)

LikeLike

]]>SELECT DISTINCT Category,

COUNT(*) OVER (PARTITION BY Category)*100.0/ COUNT(*) OVER() as PctCategory

FROM CurrentProducts

Wrong Answer 1 : your are meansed Percentage with decimals, this query division value integer and count result value also integer , so result should be integer

Wrong Answer 3: this query it will provide invalid result set as the numerator and denominator are interchanged.

Sivaguru.u

India

LikeLike

]]>2.SELECT DISTINCT Category,

COUNT(*) OVER (PARTITION BY Category)*100.0/ COUNT(*) OVER() as PctCategory

FROM CurrentProducts

because

Option no 1–> displays categories with percentages in integer values.

Option no2 –> displays categories with percentages in decimal values.

Option no 3 –> displays incorrect results.

India

LikeLike

]]>Uday

USA

LikeLike

]]>Clause – Day 11 of 35

A.) Because multiplying an aggregate by 100 (an integer) will result in the nearest integer (1) will not work. Since alculating a category’s percentage of the total products is done by dividing the quantity in the category by the quantity of all the products then multiplying by 100.0 (3) will be incorrect because it is dividing the total (COUNT(*) OVER ( )) by the category (COUNT(*) OVER(PARTITION BY Category)) instead. Because the category’s quantity is being multiplied by 100.0 (a decimal) before being divided by the quantity of all the products it will result in a decimal making (2) the correct answer.

Winner from USA: **Nagaraj Ejanthkar**

Winner from India: **P.Anish Shenoy**

I thank you all for participating here. The permanent record of this update is posted on facebook page.

LikeLike

]]>