Show me the number of staff for project with id 1.
select count(*) from project_staff where project_id = 1;
How about the number of staff each project has? List the project id and the number.
select t1.project_id, count(*) from project_staff as t1 join projects as t2 on t1.project_id = t2.project_id group by t1.project_id;
Order the result by ascending number of staff.
select t1.project_id, count(*) from project_staff as t1 join projects as t2 on t1.project_id = t2.project_id group by t1.project_id order by count(*) asc;