Without seeing any real data, wouldn't that all be a WHERE clause? I wouldn't imagine the skill was an aggregate of the applicants.
I've just skimmed over this though, I'm not having a go
I've just skimmed over this though, I'm not having a go
About 99% of the noise about mysql vs pgsql boils down to this overarching philosophical different of "try yer best" vs "only perfection is permissible". There are minor other differences aside from that, none of which I can remember at this time.
I was mostly trying to make a joke and making the psuedocode kinda sql inspired rather than cut and paste into a window like a stack exchange answer. I could have implemented it "properly" as a nested subquery I suppose. Or to make the point a little more .. obviously, just "select 0;"
example:
select count(1) cnt, department
from sales
where department_id in (1, 2, 3, 4, 5)
group by department
having count(1) >= 100;
So, it filters out all the input rows to only those department ids, and then it filters out the aggregate output rows to only those with a count() of 100 or more.This is how Oracle and MS-SQL server work.
select name, count(*)
from queries
having count(*) > 1
Column 'queries.name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. -- List employees who have the biggest salary
-- in their departments
select
Name
from
Employees e1
where
exists
(
select
1
from
Employees e2
where
e2.DepartmentID = e1.DepartmentID
having
max(e2.Salary) = e1.Salary
)