Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the job ids for jobs done more than once for a period of more than 300 days? [/INST]

Output: SELECT job_id FROM job_history WHERE end_date - start_date  > 300 GROUP BY job_id HAVING COUNT(*) >= 2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the ID for those employees who did two or more jobs in the past. [/INST]

Output: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids for employees who have held two or more jobs? [/INST]

Output: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find employee with ID and name of the country presently where (s)he is working. [/INST]

Output: SELECT T1.employee_id ,  T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id JOIN countries AS T4 ON T3.country_id  =  T4.country_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are all the employee ids and the names of the countries in which they work? [/INST]

Output: SELECT T1.employee_id ,  T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id JOIN countries AS T4 ON T3.country_id  =  T4.country_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the department name and number of employees in each of the department. [/INST]

Output: SELECT T2.department_name ,  COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id GROUP BY T2.department_name;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Give the name of each department and the number of employees in each. [/INST]

Output: SELECT T2.department_name ,  COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id GROUP BY T2.department_name;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: 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? [/INST]

Output: SELECT * FROM  job_history AS T1 JOIN employees AS T2 ON T1.employee_id  =  T2.employee_id WHERE T2.salary  >=  12000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the job history info done by employees earning a salary greater than or equal to 12000? [/INST]

Output: SELECT * FROM  job_history AS T1 JOIN employees AS T2 ON T1.employee_id  =  T2.employee_id WHERE T2.salary  >=  12000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display job title and average salary of employees. [/INST]

Output: SELECT job_title ,  AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id GROUP BY T2.job_title;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is the average salary for each job title? [/INST]

Output: SELECT job_title ,  AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id GROUP BY T2.job_title;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is the full name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163? [/INST]

Output: SELECT first_name ,  last_name FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Provide the full names of employees earning more than the employee with id 163. [/INST]

Output: SELECT first_name ,  last_name FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: return the smallest salary for every departments. [/INST]

Output: SELECT MIN(salary) ,  department_id FROM employees GROUP BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is the minimum salary in each department? [/INST]

Output: SELECT MIN(salary) ,  department_id FROM employees GROUP BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find the first name and last name and department id for those employees who earn such amount of salary which is the smallest salary of any of the departments. [/INST]

Output: SELECT first_name ,  last_name ,  department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names and department ids for the lowest paid employees across all departments. [/INST]

Output: SELECT first_name ,  last_name ,  department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find the employee id for all employees who earn more than the average salary. [/INST]

Output: SELECT employee_id FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids for employees who make more than the average? [/INST]

Output: SELECT employee_id FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee id and salary of all employees who report to Payam (first name). [/INST]

Output: SELECT employee_id ,  salary FROM employees WHERE manager_id  =  (SELECT employee_id FROM employees WHERE first_name  =  'Payam' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids of employees who report to Payam, and what are their salaries? [/INST]

Output: SELECT employee_id ,  salary FROM employees WHERE manager_id  =  (SELECT employee_id FROM employees WHERE first_name  =  'Payam' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: find the name of all departments that do actually have one or more employees assigned to them. [/INST]

Output: SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the names of departments that have at least one employee. [/INST]

Output: SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: get the details of employees who manage a department. [/INST]

Output: SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id WHERE T1.employee_id  =  T2.manager_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information regarding employees who are managers? [/INST]

Output: SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id WHERE T1.employee_id  =  T2.manager_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display all the information about the department Marketing. [/INST]

Output: SELECT * FROM  departments WHERE department_name  =  'Marketing';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information about the Marketing department? [/INST]

Output: SELECT * FROM  departments WHERE department_name  =  'Marketing';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the ID for those employees who did two or more jobs in the past. [/INST]

Output: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids for those who had two or more jobs. [/INST]

Output: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the unique ids of those departments where any manager is managing 4 or more employees. [/INST]

Output: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Give the distinct department ids of departments in which a manager is in charge of 4 or more employees? [/INST]

Output: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find the job ID for those jobs which average salary is above 8000. [/INST]

Output: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the job ids corresponding to jobs with average salary above 8000? [/INST]

Output: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee ID and job name for all those jobs in department 80. [/INST]

Output: SELECT T1.employee_id ,  T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id WHERE T1.department_id = 80;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: what are the employee ids and job titles for employees in department 80? [/INST]

Output: SELECT T1.employee_id ,  T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id WHERE T1.department_id = 80;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is the first name and job id for all employees in the Finance department? [/INST]

Output: SELECT T1.first_name ,  T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id WHERE T2.department_name  =  'Finance';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Give the first name and job id for all employees in the Finance department. [/INST]

Output: SELECT T1.first_name ,  T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id WHERE T2.department_name  =  'Finance';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display all the information of the employees whose salary if within the range of smallest salary and 2500. [/INST]

Output: SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information regarding employees with salaries above the minimum and under 2500? [/INST]

Output: SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find the ids of the employees who does not work in those departments where some employees works whose manager id within the range 100 and 200. [/INST]

Output: SELECT * FROM employees WHERE department_id NOT IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the ids for employees who do not work in departments with managers that have ids between 100 and 200? [/INST]

Output: SELECT * FROM employees WHERE department_id NOT IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara. [/INST]

Output: SELECT first_name ,  last_name ,  hire_date FROM employees WHERE department_id  =  (SELECT department_id FROM employees WHERE first_name  =  "Clara");


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names and hire dates for employees in the same department as someone with the first name Clara? [/INST]

Output: SELECT first_name ,  last_name ,  hire_date FROM employees WHERE department_id  =  (SELECT department_id FROM employees WHERE first_name  =  "Clara");


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara. [/INST]

Output: SELECT first_name ,  last_name ,  hire_date FROM employees WHERE department_id  =  ( SELECT department_id FROM employees WHERE first_name  =  "Clara") AND first_name != "Clara";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names and hire dates for employees in the same department as someone with the first name Clara, not including Clara? [/INST]

Output: SELECT first_name ,  last_name ,  hire_date FROM employees WHERE department_id  =  ( SELECT department_id FROM employees WHERE first_name  =  "Clara") AND first_name != "Clara";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a ’T’. [/INST]

Output: SELECT employee_id ,  first_name ,  last_name FROM employees WHERE department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%T%' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the ids and full names for employees who work in a department that has someone with a first name that contains the letter T? [/INST]

Output: SELECT employee_id ,  first_name ,  last_name FROM employees WHERE department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%T%' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee number, name( first name and last name ), and salary for all employees who earn more than the average salary and who work in a department with any employee with a 'J' in their first name. [/INST]

Output: SELECT employee_id ,  first_name ,  last_name ,  salary FROM employees WHERE salary  >  ( SELECT AVG (salary) FROM employees ) AND department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%J%');


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the ids, full names, and salaries for employees making more than average and who work in a department with employees who have the letter J in their first name? [/INST]

Output: SELECT employee_id ,  first_name ,  last_name ,  salary FROM employees WHERE salary  >  ( SELECT AVG (salary) FROM employees ) AND department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%J%');


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN. [/INST]

Output: SELECT employee_id ,  job_id FROM employees WHERE salary  <  ( SELECT min(salary) FROM employees WHERE job_id  =  'MK_MAN' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids and job ids for employees who make less than the lowest earning employee with title MK_MAN? [/INST]

Output: SELECT employee_id ,  job_id FROM employees WHERE salary  <  ( SELECT min(salary) FROM employees WHERE job_id  =  'MK_MAN' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee number, name( first name and last name ) and job title for all employees whose salary is more than any salary of those employees whose job title is PU_MAN. [/INST]

Output: SELECT employee_id ,  first_name ,  last_name ,  job_id FROM employees WHERE salary  >  ( SELECT max(salary) FROM employees WHERE job_id  =  'PU_MAN' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids, full names, and job ids for employees who make more than the highest earning employee with title PU_MAN? [/INST]

Output: SELECT employee_id ,  first_name ,  last_name ,  job_id FROM employees WHERE salary  >  ( SELECT max(salary) FROM employees WHERE job_id  =  'PU_MAN' );


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the department id and the total salary for those departments which contains at least two employees. [/INST]

Output: SELECT department_id ,  SUM(salary) FROM employees GROUP BY department_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are total salaries and department id for each department that has more than 2 employees? [/INST]

Output: SELECT department_id ,  SUM(salary) FROM employees GROUP BY department_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display all the information of those employees who did not have any job in the past. [/INST]

Output: SELECT * FROM employees WHERE employee_id NOT IN (SELECT employee_id FROM job_history);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information about employees who have never had a job in the past? [/INST]

Output: SELECT * FROM employees WHERE employee_id NOT IN (SELECT employee_id FROM job_history);


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the department ID, full name (first and last name), salary for those employees who is highest salary in every department. [/INST]

Output: SELECT first_name ,   last_name ,   salary ,  department_id ,  MAX(salary) FROM employees GROUP BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the department ids, full names, and salaries for employees who make the most in their departments? [/INST]

Output: SELECT first_name ,   last_name ,   salary ,  department_id ,  MAX(salary) FROM employees GROUP BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the first and last name, department, city, and state province for each employee. [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T2.department_name ,  T3.city ,  T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names, departments, cities, and state provinces for each employee? [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T2.department_name ,  T3.city ,  T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display those employees who contain a letter z to their first name and also display their last name, city. [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id WHERE T1.first_name LIKE '%z%';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names and cities of employees who have the letter Z in their first names? [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id WHERE T1.first_name LIKE '%z%';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the department name, city, and state province for each department. [/INST]

Output: SELECT T1.department_name ,  T2.city ,  T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id  =  T1.location_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the department names, cities, and state provinces for each department? [/INST]

Output: SELECT T1.department_name ,  T2.city ,  T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id  =  T1.location_id;