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
What is the average number of employees of the departments whose rank is between 10 and 15?
assistant
SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15
human
How many heads of the departments are older than 56 ?
assistant
SELECT count(*) FROM head WHERE age > 56
human
How many departments are led by heads who are not mentioned?
assistant
SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management);
human
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?
assistant
SELECT T1.name , T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'
human
What are the distinct ages of the heads who are acting?
assistant
SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'
human
How many acting statuses are there?
assistant
SELECT COUNT( DISTINCT temporary_acting ) FROM management ;