human
Schema:
regions (REGION_ID, REGION_NAME)
countries (COUNTRY_ID, COUNTRY_NAME, REGION_ID)
departments (DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID)
jobs (JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY)
employees (EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID)
job_history (EMPLOYEE_ID, START_DATE, END_DATE, JOB_ID, DEPARTMENT_ID)
locations (LOCATION_ID, STREET_ADDRESS, POSTAL_CODE, CITY, STATE_PROVINCE, COUNTRY_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
display the department id and the total salary for those departments which contains at least two employees.
assistant
SELECT department_id , SUM( salary ) FROM employees GROUP BY department_id HAVING COUNT( * ) > = 2;
human
What are the first and last names of employees in department id 90?
assistant
SELECT FIRST_NAME , LAST_NAME FROM employees WHERE department_id = 90;
human
What department id is Steven King in?
assistant
SELECT department_ID FROM employees WHERE FIRST_NAME = "Steven" AND LAST_NAME = "King" ;