select Major_category, sum(CAST(Women as Float)) / sum(CAST(Total as Float)) as SW
group by Major_category
order by SW
What I expected to happen: SW column has decimal values ranging from 0 to 1
What actually happened: as you can see in the result table, some major category has a ratio greater than 1, and some has suspiciously low ratio such as 0.03
Other details: I was under the impression there’s no overlap the amount of people majoring in each major, thus, the sum of all women majoring in a
Major_category divided by total amount of people majoring in a given
Major_category should range between 0 to 1.
Please let me know what’s going on here? Thank you.