Comparing COUNT values within a query?
- by outsyncof
I have the following tables in a relation:
person(ssn,sex)
employment(ssn,workweeksperyear)
assume ssn is a key.
My assignment was to do this:
Given as input the number of weeks per year a person has worked, determine whether there are more males than females who work more weeks than the input value.
SELECT COUNT(sex) AS NumMales
FROM person
WHERE sex = 'Male' AND ssn IN (SELECT ssn
FROM employment
WHERE workweeksperyear > 48);
The above query gets me the number of males for an input value and I could do the same for number of females but how do I compare the 2 results?
Any help will be greatly appreciated!