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
Can you return all detailed info of jobs which was done by any of the employees who is presently earning a salary on and above 12000?
assistant
SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.employee_id = T2.employee_id WHERE T2.salary >= 12000
human
display the job title of jobs which minimum salary is greater than 9000.
assistant
SELECT job_title FROM jobs WHERE min_salary > 9000
human
List the full name (first and last name), and salary for those employees who earn below 6000.
assistant
SELECT first_name , last_name , salary FROM employees WHERE salary < 6000
human
Find the job ID for those jobs which average salary is above 8000.
assistant
SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000
human
what is the phone number of employees whose salary is in the range of 8000 and 12000?
assistant
SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000
human
What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000?
assistant
SELECT job_title , max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000 ;