human
Schema:
department (Department_ID, Name, Creation, Ranking, Budget_in_Billions, Num_Employees)
head (head_ID, name, born_state, age)
management (department_ID, head_ID, temporary_acting)
Please answer with SQL.
assistant
Sure, I understand.
human
How many departments are there?
assistant
SELECT COUNT( * ) FROM department;
human
How many departments are led by heads who are mentioned in the database?
assistant
SELECT COUNT( * ) FROM department WHERE department_id IN ( SELECT department_id FROM management ) ;