db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
manufacturer | select t1.manufacturer_id , t1.num_of_shops from manufacturer as t1 join furniture_manufacte as t2 on t1.manufacturer_id = t2.manufacturer_id order by t2.price_in_dollar desc limit 1 | Question: find the id and number of shops for the company that produces the most expensive furniture. | Tables: manufacturer -> Manufacturer_ID, Open_Year, Name, Num_of_Factories, Num_of_Shops. furniture -> Furniture_ID, Name, Num_of_Component, Market_Rate. furniture_manufacte -> Manufacturer_ID, Furniture_ID, Price_in... | find the id and number of shops for the company that produces the most expensive furniture. |
manufacturer | select count(*) , t1.name from manufacturer as t1 join furniture_manufacte as t2 on t1.manufacturer_id = t2.manufacturer_id group by t1.manufacturer_id | Question: find the number of funiture types produced by each manufacturer as well as the company names. | Tables: manufacturer -> Manufacturer_ID, Open_Year, Name, Num_of_Factories, Num_of_Shops. furniture -> Furniture_ID, Name, Num_of_Component, Market_Rate. furniture_manufacte -> Manufacturer_ID, Furniture_ID, Price_... | find the number of funiture types produced by each manufacturer as well as the company names. |
manufacturer | select t1.name , t2.price_in_dollar from furniture as t1 join furniture_manufacte as t2 on t1.furniture_id = t2.furniture_id | Question: give me the names and prices of furnitures which some companies are manufacturing. | Tables: manufacturer -> Manufacturer_ID, Open_Year, Name, Num_of_Factories, Num_of_Shops. furniture -> Furniture_ID, Name, Num_of_Component, Market_Rate. furniture_manufacte -> Manufacturer_ID, Furniture_ID, Price_in_Dollar. ... | give me the names and prices of furnitures which some companies are manufacturing. |
manufacturer | select market_rate , name from furniture where furniture_id not in (select furniture_id from furniture_manufacte) | Question: find the market shares and names of furnitures which no any company is producing in our records. | Tables: manufacturer -> Manufacturer_ID, Open_Year, Name, Num_of_Factories, Num_of_Shops. furniture -> Furniture_ID, Name, Num_of_Component, Market_Rate. furniture_manufacte -> Manufacturer_ID, Furniture_ID, Pri... | find the market shares and names of furnitures which no any company is producing in our records. |
manufacturer | select t3.name from furniture as t1 join furniture_manufacte as t2 on t1.furniture_id = t2.furniture_id join manufacturer as t3 on t2.manufacturer_id = t3.manufacturer_id where t1.num_of_component < 6 intersect select t3.name from furniture as t1 join furniture_manufacte as t2 on t1.furniture_id = t2.furniture_... | Question: find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components. | Tables: manufacturer -> Manufacturer_ID, Open_Year, Name, Num_of_Factories, Num_of_Shops. furniture -> Furniture_ID, Name, Num_of_Component, Market_Rate. furniture_manufacte ->... | find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components. |
hr_1 | select t1.first_name , t2.department_name from employees as t1 join departments as t2 on t1.department_id = t2.department_id | Question: display the first name and department name for each employee. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRS... | display the first name and department name for each employee. |
hr_1 | select t1.first_name , t2.department_name from employees as t1 join departments as t2 on t1.department_id = t2.department_id | Question: what are the first name and department name of all employees? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRS... | what are the first name and department name of all employees? |
hr_1 | select first_name , last_name , salary from employees where salary < 6000 | Question: list the full name (first and last name), and salary for those employees who earn below 6000. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY... | list the full name (first and last name), and salary for those employees who earn below 6000. |
hr_1 | select first_name , last_name , salary from employees where salary < 6000 | Question: what are the full names and salaries for any employees earning less than 6000? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> ... | what are the full names and salaries for any employees earning less than 6000? |
hr_1 | select first_name , department_id from employees where last_name = 'mcewen' | Question: display the first name, and department number for all employees whose last name is 'mcewen'. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY.... | display the first name, and department number for all employees whose last name is 'mcewen'. |
hr_1 | select first_name , department_id from employees where last_name = 'mcewen' | Question: what are the first names and department numbers for employees with last name mcewen? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employe... | what are the first names and department numbers for employees with last name mcewen? |
hr_1 | select * from employees where department_id = 'null' | Question: return all the information for all employees without any department number. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMP... | return all the information for all employees without any department number. |
hr_1 | select * from employees where department_id = 'null' | Question: what are all the employees without a department number? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME... | what are all the employees without a department number? |
hr_1 | select * from departments where department_name = 'marketing' | Question: display all the information about the department marketing. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_... | display all the information about the department marketing. |
hr_1 | select * from departments where department_name = 'marketing' | Question: what is all the information about the marketing department? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_... | what is all the information about the marketing department? |
hr_1 | select hire_date from employees where first_name not like '%m%' | Question: when is the hire date for those employees whose first name does not containing the letter m? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY.... | when is the hire date for those employees whose first name does not containing the letter m? |
hr_1 | select hire_date from employees where first_name not like '%m%' | Question: on what dates were employees without the letter m in their first names hired? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> E... | on what dates were employees without the letter m in their first names hired? |
hr_1 | select first_name , last_name , hire_date , salary , department_id from employees where first_name not like '%m%' | Question: display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter m. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCA... | display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter m. |
hr_1 | select first_name , last_name , hire_date , salary , department_id from employees where first_name not like '%m%' | Question: what are the full name, hire date, salary, and department id for employees without the letter m in their first name? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE,... | what are the full name, hire date, salary, and department id for employees without the letter m in their first name? |
hr_1 | select first_name , last_name , hire_date , salary , department_id from employees where first_name not like '%m%' order by department_id | Question: display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter m and make the result set in ascending order by department number. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID.... | display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter m and make the result set in ascending order by department number. |
hr_1 | select first_name , last_name , hire_date , salary , department_id from employees where first_name not like '%m%' order by department_id | Question: what are the full name, hire data, salary and department id for employees without the letter m in their first name, ordered by ascending department id? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCA... | what are the full name, hire data, salary and department id for employees without the letter m in their first name, ordered by ascending department id? |
hr_1 | select phone_number from employees where salary between 8000 and 12000 | Question: what is the phone number of employees whose salary is in the range of 8000 and 12000? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employ... | what is the phone number of employees whose salary is in the range of 8000 and 12000? |
hr_1 | select phone_number from employees where salary between 8000 and 12000 | Question: return the phone numbers of employees with salaries between 8000 and 12000. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMP... | return the phone numbers of employees with salaries between 8000 and 12000. |
hr_1 | select * from employees where salary between 8000 and 12000 and commission_pct != 'null' or department_id != 40 | Question: display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID... | display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40. |
hr_1 | select * from employees where salary between 8000 and 12000 and commission_pct != 'null' or department_id != 40 | Question: return all information about employees with salaries between 8000 and 12000 for which commission is not null or where their department id is not 40. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATIO... | return all information about employees with salaries between 8000 and 12000 for which commission is not null or where their department id is not 40. |
hr_1 | select first_name , last_name , salary from employees where commission_pct = 'null' | Question: what are the full name (first and last name) and salary for all employees who does not have any value for commission? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE... | what are the full name (first and last name) and salary for all employees who does not have any value for commission? |
hr_1 | select first_name , last_name , salary from employees where commission_pct = 'null' | Question: return the full names and salaries of employees with null commissions. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE... | return the full names and salaries of employees with null commissions. |
hr_1 | select first_name , last_name , salary from employees where first_name like '%m' | Question: display the first and last name, and salary for those employees whose first name is ending with the letter m. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SA... | display the first and last name, and salary for those employees whose first name is ending with the letter m. |
hr_1 | select first_name , last_name , salary from employees where first_name like '%m' | Question: return the full names and salaries for employees with first names that end with the letter m. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY... | return the full names and salaries for employees with first names that end with the letter m. |
hr_1 | select job_id , hire_date from employees where hire_date between '2007-11-05' and '2009-07-05' | Question: find job id and date of hire for those employees who was hired between november 5th, 2007 and july 5th, 2009. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SA... | find job id and date of hire for those employees who was hired between november 5th, 2007 and july 5th, 2009. |
hr_1 | select job_id , hire_date from employees where hire_date between '2007-11-05' and '2009-07-05' | Question: what are the job ids and dates of hire for employees hired after november 5th, 2007 and before july 5th, 2009? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_S... | what are the job ids and dates of hire for employees hired after november 5th, 2007 and before july 5th, 2009? |
hr_1 | select first_name , last_name from employees where department_id = 70 or department_id = 90 | Question: what are the first and last name for those employees who works either in department 70 or 90? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY... | what are the first and last name for those employees who works either in department 70 or 90? |
hr_1 | select first_name , last_name from employees where department_id = 70 or department_id = 90 | Question: what are the full names of employees who with in department 70 or 90? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_... | what are the full names of employees who with in department 70 or 90? |
hr_1 | select salary , manager_id from employees where manager_id != 'null' | Question: find the salary and manager number for those employees who is working under a manager. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. emplo... | find the salary and manager number for those employees who is working under a manager. |
hr_1 | select salary , manager_id from employees where manager_id != 'null' | Question: what are the salaries and manager ids for employees who have managers? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE... | what are the salaries and manager ids for employees who have managers? |
hr_1 | select * from employees where hire_date < '2002-06-21' | Question: display all the details from employees table for those employees who was hired before 2002-06-21. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SA... | display all the details from employees table for those employees who was hired before 2002-06-21. |
hr_1 | select * from employees where hire_date < '2002-06-21' | Question: what is all the information about employees hired before june 21, 2002? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYE... | what is all the information about employees hired before june 21, 2002? |
hr_1 | select * from employees where first_name like '%d%' or first_name like '%s%' order by salary desc | Question: display all the information for all employees who have the letters d or s in their first name and also arrange the result in descending order by salary. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOC... | display all the information for all employees who have the letters d or s in their first name and also arrange the result in descending order by salary. |
hr_1 | select * from employees where first_name like '%d%' or first_name like '%s%' order by salary desc | Question: what is all the information about employees with d or s in their first name, ordered by salary descending? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALAR... | what is all the information about employees with d or s in their first name, ordered by salary descending? |
hr_1 | select * from employees where hire_date > '1987-09-07' | Question: display those employees who joined after 7th september, 1987. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRS... | display those employees who joined after 7th september, 1987. |
hr_1 | select * from employees where hire_date > '1987-09-07' | Question: which employees were hired after september 7th, 1987? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME, ... | which employees were hired after september 7th, 1987? |
hr_1 | select job_title from jobs where min_salary > 9000 | Question: display the job title of jobs which minimum salary is greater than 9000. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOY... | display the job title of jobs which minimum salary is greater than 9000. |
hr_1 | select job_title from jobs where min_salary > 9000 | Question: which job titles correspond to jobs with salaries over 9000? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST... | which job titles correspond to jobs with salaries over 9000? |
hr_1 | select job_title , max_salary - min_salary from jobs where max_salary between 12000 and 18000 | Question: display job title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs ->... | display job title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000. |
hr_1 | select job_title , max_salary - min_salary from jobs where max_salary between 12000 and 18000 | Question: what are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX... | what are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000? |
hr_1 | select email from employees where commission_pct = 'null' and salary between 7000 and 12000 and department_id = 50 | Question: display the emails of the employees who have no commission percentage and salary within the range 7000 to 12000 and works in that department which number is 50. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER... | display the emails of the employees who have no commission percentage and salary within the range 7000 to 12000 and works in that department which number is 50. |
hr_1 | select email from employees where commission_pct = 'null' and salary between 7000 and 12000 and department_id = 50 | Question: what are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE,... | what are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50? |
hr_1 | select employee_id , max(end_date) from job_history group by employee_id | Question: display the employee id for each employee and the date on which he ended his previous job. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. e... | display the employee id for each employee and the date on which he ended his previous job. |
hr_1 | select employee_id , max(end_date) from job_history group by employee_id | Question: what are the employee ids for each employee and final dates of employment at their last job? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY.... | what are the employee ids for each employee and final dates of employment at their last job? |
hr_1 | select department_id from employees group by department_id having count(commission_pct) > 10 | Question: display those departments where more than ten employees work who got a commission percentage. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY... | display those departments where more than ten employees work who got a commission percentage. |
hr_1 | select department_id from employees group by department_id having count(commission_pct) > 10 | Question: what are the department ids for which more than 10 employees had a commission? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> ... | what are the department ids for which more than 10 employees had a commission? |
hr_1 | select distinct department_id from employees group by department_id , manager_id having count(employee_id) >= 4 | Question: find the ids of the departments where any manager is managing 4 or more employees. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees... | find the ids of the departments where any manager is managing 4 or more employees. |
hr_1 | select distinct department_id from employees group by department_id , manager_id having count(employee_id) >= 4 | Question: what are department ids for departments with managers managing more than 3 employees? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employ... | what are department ids for departments with managers managing more than 3 employees? |
hr_1 | select department_id , avg(salary) from employees where commission_pct != 'null' group by department_id | Question: display the average salary of employees for each department who gets a commission percentage. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY... | display the average salary of employees for each department who gets a commission percentage. |
hr_1 | select department_id , avg(salary) from employees where commission_pct != 'null' group by department_id | Question: what is the average salary of employees who have a commission percentage that is not null? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. e... | what is the average salary of employees who have a commission percentage that is not null? |
hr_1 | select country_id , count(*) from locations group by country_id | Question: display the country id and number of cities for each country. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRS... | display the country id and number of cities for each country. |
hr_1 | select country_id , count(*) from locations group by country_id | Question: give the country id and corresponding count of cities in each country. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE... | give the country id and corresponding count of cities in each country. |
hr_1 | select job_id from job_history where end_date - start_date > 300 group by job_id having count(*) >= 2 | Question: display job id for those jobs that were done by two or more for more than 300 days. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employee... | display job id for those jobs that were done by two or more for more than 300 days. |
hr_1 | select job_id from job_history where end_date - start_date > 300 group by job_id having count(*) >= 2 | Question: what are the job ids for jobs done more than once for a period of more than 300 days? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employ... | what are the job ids for jobs done more than once for a period of more than 300 days? |
hr_1 | select employee_id from job_history group by employee_id having count(*) >= 2 | Question: display the id for those employees who did two or more jobs in the past. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOY... | display the id for those employees who did two or more jobs in the past. |
hr_1 | select employee_id from job_history group by employee_id having count(*) >= 2 | Question: what are the employee ids for employees who have held two or more jobs? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYE... | what are the employee ids for employees who have held two or more jobs? |
hr_1 | 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 | Question: find employee with id and name of the country presently where (s)he is working. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees ->... | find employee with id and name of the country presently where (s)he is working. |
hr_1 | 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 | Question: what are all the employee ids and the names of the countries in which they work? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -... | what are all the employee ids and the names of the countries in which they work? |
hr_1 | 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 | Question: display the department name and number of employees in each of the department. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> ... | display the department name and number of employees in each of the department. |
hr_1 | 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 | Question: give the name of each department and the number of employees in each. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_... | give the name of each department and the number of employees in each. |
hr_1 | select * from job_history as t1 join employees as t2 on t1.employee_id = t2.employee_id where t2.salary >= 12000 | 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? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> J... | 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? |
hr_1 | select * from job_history as t1 join employees as t2 on t1.employee_id = t2.employee_id where t2.salary >= 12000 | Question: what is all the job history info done by employees earning a salary greater than or equal to 12000? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_... | what is all the job history info done by employees earning a salary greater than or equal to 12000? |
hr_1 | 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 | Question: display job title and average salary of employees. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME, LAS... | display job title and average salary of employees. |
hr_1 | 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 | Question: what is the average salary for each job title? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME, LAST_NA... | what is the average salary for each job title? |
hr_1 | select first_name , last_name from employees where salary > (select salary from employees where employee_id = 163 ) | 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? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, ... | what is the full name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163? |
hr_1 | select first_name , last_name from employees where salary > (select salary from employees where employee_id = 163 ) | Question: provide the full names of employees earning more than the employee with id 163. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees ->... | provide the full names of employees earning more than the employee with id 163. |
hr_1 | select min(salary) , department_id from employees group by department_id | Question: return the smallest salary for every departments. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME, LAST... | return the smallest salary for every departments. |
hr_1 | select min(salary) , department_id from employees group by department_id | Question: what is the minimum salary in each department? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME, LAST_NA... | what is the minimum salary in each department? |
hr_1 | select first_name , last_name , department_id from employees where salary in (select min(salary) from employees group by department_id) | 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. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_I... | 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. |
hr_1 | select first_name , last_name , department_id from employees where salary in (select min(salary) from employees group by department_id) | Question: what are the full names and department ids for the lowest paid employees across all departments. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SAL... | what are the full names and department ids for the lowest paid employees across all departments. |
hr_1 | select employee_id from employees where salary > (select avg(salary) from employees) | Question: find the employee id for all employees who earn more than the average salary. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> E... | find the employee id for all employees who earn more than the average salary. |
hr_1 | select employee_id from employees where salary > (select avg(salary) from employees) | Question: what are the employee ids for employees who make more than the average? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYE... | what are the employee ids for employees who make more than the average? |
hr_1 | select employee_id , salary from employees where manager_id = (select employee_id from employees where first_name = 'payam' ) | Question: display the employee id and salary of all employees who report to payam (first name). | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employ... | display the employee id and salary of all employees who report to payam (first name). |
hr_1 | select employee_id , salary from employees where manager_id = (select employee_id from employees where first_name = 'payam' ) | Question: what are the employee ids of employees who report to payam, and what are their salaries? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. emp... | what are the employee ids of employees who report to payam, and what are their salaries? |
hr_1 | select distinct t2.department_name from employees as t1 join departments as t2 on t1.department_id = t2.department_id | Question: find the name of all departments that do actually have one or more employees assigned to them. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALAR... | find the name of all departments that do actually have one or more employees assigned to them. |
hr_1 | select distinct t2.department_name from employees as t1 join departments as t2 on t1.department_id = t2.department_id | Question: what are the names of departments that have at least one employee. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID,... | what are the names of departments that have at least one employee. |
hr_1 | select distinct * from employees as t1 join departments as t2 on t1.department_id = t2.department_id where t1.employee_id = t2.manager_id | Question: get the details of employees who manage a department. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_NAME, ... | get the details of employees who manage a department. |
hr_1 | select distinct * from employees as t1 join departments as t2 on t1.department_id = t2.department_id where t1.employee_id = t2.manager_id | Question: what is all the information regarding employees who are managers? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, ... | what is all the information regarding employees who are managers? |
hr_1 | select * from departments where department_name = 'marketing' | Question: display all the information about the department marketing. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_... | display all the information about the department marketing. |
hr_1 | select * from departments where department_name = 'marketing' | Question: what is all the information about the marketing department? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRST_... | what is all the information about the marketing department? |
hr_1 | select employee_id from job_history group by employee_id having count(*) >= 2 | Question: display the id for those employees who did two or more jobs in the past. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOY... | display the id for those employees who did two or more jobs in the past. |
hr_1 | select employee_id from job_history group by employee_id having count(*) >= 2 | Question: what are the employee ids for those who had two or more jobs. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID, FIRS... | what are the employee ids for those who had two or more jobs. |
hr_1 | select distinct department_id from employees group by department_id , manager_id having count(employee_id) >= 4 | Question: what are the unique ids of those departments where any manager is managing 4 or more employees. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALA... | what are the unique ids of those departments where any manager is managing 4 or more employees. |
hr_1 | select distinct department_id from employees group by department_id , manager_id having count(employee_id) >= 4 | Question: give the distinct department ids of departments in which a manager is in charge of 4 or more employees? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, ... | give the distinct department ids of departments in which a manager is in charge of 4 or more employees? |
hr_1 | select job_id from employees group by job_id having avg(salary) > 8000 | Question: find the job id for those jobs which average salary is above 8000. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOYEE_ID,... | find the job id for those jobs which average salary is above 8000. |
hr_1 | select job_id from employees group by job_id having avg(salary) > 8000 | Question: what are the job ids corresponding to jobs with average salary above 8000? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPL... | what are the job ids corresponding to jobs with average salary above 8000? |
hr_1 | 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 | Question: display the employee id and job name for all those jobs in department 80. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLO... | display the employee id and job name for all those jobs in department 80. |
hr_1 | 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 | Question: what are the employee ids and job titles for employees in department 80? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMPLOY... | what are the employee ids and job titles for employees in department 80? |
hr_1 | 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' | Question: what is the first name and job id for all employees in the finance department? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> ... | what is the first name and job id for all employees in the finance department? |
hr_1 | 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' | Question: give the first name and job id for all employees in the finance department. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY. employees -> EMP... | give the first name and job id for all employees in the finance department. |
hr_1 | select * from employees where salary between (select min(salary) from employees) and 2500 | Question: display all the information of the employees whose salary if within the range of smallest salary and 2500. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALAR... | display all the information of the employees whose salary if within the range of smallest salary and 2500. |
hr_1 | select * from employees where salary between (select min(salary) from employees) and 2500 | Question: what is all the information regarding employees with salaries above the minimum and under 2500? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALA... | what is all the information regarding employees with salaries above the minimum and under 2500? |
hr_1 | select * from employees where department_id not in (select department_id from departments where manager_id between 100 and 200) | 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. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. ... | 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. |
hr_1 | select * from employees where department_id not in (select department_id from departments where manager_id between 100 and 200) | Question: what are the ids for employees who do not work in departments with managers that have ids between 100 and 200? | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TITLE, MIN_S... | what are the ids for employees who do not work in departments with managers that have ids between 100 and 200? |
hr_1 | select first_name , last_name , hire_date from employees where department_id = (select department_id from employees where first_name = 'clara') | Question: display the employee name ( first name and last name ) and hire date for all employees in the same department as clara. | Tables: regions -> REGION_ID, REGION_NAME. countries -> COUNTRY_ID, COUNTRY_NAME, REGION_ID. departments -> DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID. jobs -> JOB_ID, JOB_TIT... | display the employee name ( first name and last name ) and hire date for all employees in the same department as clara. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.