human
Schema:
Activity (actid, activity_name)
Participates_in (stuid, actid)
Faculty_Participates_in (FacID, actid)
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Faculty (FacID, Lname, Fname, Rank, Sex, Phone, Room, Building)
Please answer with SQL.
assistant
Sure, I understand.
human
Show all the activity names and the number of faculty involved in each activity.
assistant
SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
human
Show the number of male and female assistant professors.
assistant
SELECT sex , count(*) FROM Faculty WHERE rank = 'AsstProf' GROUP BY sex
human
For each faculty rank, show the number of faculty members who have it.
assistant
SELECT rank , count(*) FROM Faculty GROUP BY rank
human
Show all the buildings along with the number of faculty members the buildings have.
assistant
SELECT building , count(*) FROM Faculty GROUP BY building
human
Show all the buildings that have at least 10 professors.
assistant
SELECT building FROM Faculty WHERE rank = 'Professor' GROUP BY building HAVING count(*) >= 10
human
Count the number of Professors who have office in building NEB.
assistant
SELECT COUNT( * ) FROM Faculty WHERE Rank = "Professor" AND building = "NEB" ;