sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display those departments where more than ten employees work who got a commission percentage.
SQL: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the department ids for which more than 10 employees had a commission?
SQL: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the ids of the departments where any manager is managing 4 or more employees.
SQL: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are department ids for departments with managers managing more than 3 employees?
SQL: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display the average salary of employees for each department who gets a commission percentage.
SQL: SELECT department_id ,  AVG(salary) FROM employees WHERE commission_pct != "null" GROUP BY department_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the average salary of employees who have a commission percentage that is not null?
SQL: SELECT department_id ,  AVG(salary) FROM employees WHERE commission_pct != "null" GROUP BY department_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display the country ID and number of cities for each country.
SQL: SELECT country_id ,  COUNT(*) FROM locations GROUP BY country_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Give the country id and corresponding count of cities in each country.
SQL: SELECT country_id ,  COUNT(*) FROM locations GROUP BY country_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display job ID for those jobs that were done by two or more for more than 300 days.
SQL: SELECT job_id FROM job_history WHERE end_date - start_date  > 300 GROUP BY job_id HAVING COUNT(*) >= 2
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the job ids for jobs done more than once for a period of more than 300 days?
SQL: SELECT job_id FROM job_history WHERE end_date - start_date  > 300 GROUP BY job_id HAVING COUNT(*) >= 2
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display the ID for those employees who did two or more jobs in the past.
SQL: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the employee ids for employees who have held two or more jobs?
SQL: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find employee with ID and name of the country presently where (s)he is working.
SQL: 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are all the employee ids and the names of the countries in which they work?
SQL: 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display the department name and number of employees in each of the department.
SQL: 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Give the name of each department and the number of employees in each.
SQL: 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



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?
SQL: SELECT * FROM  job_history AS T1 JOIN employees AS T2 ON T1.employee_id  =  T2.employee_id WHERE T2.salary  >=  12000
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is all the job history info done by employees earning a salary greater than or equal to 12000?
SQL: SELECT * FROM  job_history AS T1 JOIN employees AS T2 ON T1.employee_id  =  T2.employee_id WHERE T2.salary  >=  12000
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: display job title and average salary of employees.
SQL: 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the average salary for each job title?
SQL: 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



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?
SQL: SELECT first_name ,  last_name FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 )
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Provide the full names of employees earning more than the employee with id 163.
SQL: SELECT first_name ,  last_name FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 )
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: return the smallest salary for every departments.
SQL: SELECT MIN(salary) ,  department_id FROM employees GROUP BY department_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the minimum salary in each department?
SQL: SELECT MIN(salary) ,  department_id FROM employees GROUP BY department_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



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.
SQL: SELECT first_name ,  last_name ,  department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the full names and department ids for the lowest paid employees across all departments.
SQL: SELECT first_name ,  last_name ,  department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the employee id for all employees who earn more than the average salary.
SQL: SELECT employee_id FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees)
-- Language PostgreSQL
        -- Tables: 
             -- Table: regions 
columns : [['region id', 'number'], ['region name', 'text']]

 -- Table: countries 
columns : [['country id', 'text'], ['country name', 'text'], ['region id', 'number']]

 -- Table: departments 
columns : [['department id', 'number'], ['department name', 'text'], ['manager id', 'number'], ['location id', 'number']]

 -- Table: jobs 
columns : [['job id', 'text'], ['job title', 'text'], ['min salary', 'number'], ['max salary', 'number']]

 -- Table: employees 
columns : [['employee id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['phone number', 'text'], ['hire date', 'time'], ['job id', 'text'], ['salary', 'number'], ['commission pct', 'number'], ['manager id', 'number'], ['department id', 'number']]

 -- Table: job history 
columns : [['employee id', 'number'], ['start date', 'time'], ['end date', 'time'], ['job id', 'text'], ['department id', 'number']]

 -- Table: locations 
columns : [['location id', 'number'], ['street address', 'text'], ['postal code', 'text'], ['city', 'text'], ['state province', 'text'], ['country id', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the employee ids for employees who make more than the average?
SQL: SELECT employee_id FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees)