Could anyone please help me understand the logic behind this?
How come SUM(Low_wage_jobs) / SUM(Total) results in 0? The result should be the Share_low_wage shown below.
You can do the maths, if you divide 60116 / 357130, the result is 0.1683308…
In fact, that’s the way I tried to solve it at first because it didn’t make sense for me to divide an average by another.
SELECT Major_category, SUM(Low_wage_jobs), SUM(Total), AVG(Low_wage_jobs) / AVG(Total) AS Share_low_wage, SUM(Low_wage_jobs)/ SUM(Total) AS test FROM new_grads GROUP BY Major_category HAVING Share_low_wage > 0.1;
What I expected to happen:
Column “test” should display the same results of column Share_low_wage
What actually happened:
Column test results in 0
Thank you in advance!