Database: hr_1

Question: What is all the information regarding employees who are managers?
SQL: 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 about the Marketing department?
SQL: SELECT * FROM  departments WHERE department_name  =  'Marketing'

Question: What are the employee ids for those who had two or more jobs.
SQL: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2

Question: Give the distinct department ids of departments in which a manager is in charge of 4 or more employees?
SQL: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4

Question: What are the job ids corresponding to jobs with average salary above 8000?
SQL: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000

Question: what are the employee ids and job titles for employees in department 80?
SQL: 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: Give the first name and job id for all employees in the Finance department.
SQL: 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 all the information regarding employees with salaries above the minimum and under 2500?
SQL: SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500

Question: What are the ids for employees who do not work in departments with managers that have ids between 100 and 200?
SQL: SELECT * FROM employees WHERE department_id NOT IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200)

Question: What are the full names and hire dates for employees in the same department as someone with the first name Clara?
SQL: SELECT first_name ,  last_name ,  hire_date FROM employees WHERE department_id  =  (SELECT department_id FROM employees WHERE first_name  =  "Clara")

Question: What are the full names and hire dates for employees in the same department as someone with the first name Clara, not including Clara?
SQL: SELECT first_name ,  last_name ,  hire_date FROM employees WHERE department_id  =  ( SELECT department_id FROM employees WHERE first_name  =  "Clara") AND first_name ! =  "Clara"

Question: What are the ids and full names for employees who work in a department that has someone with a first name that contains the letter T?
SQL: SELECT employee_id ,  first_name ,  last_name FROM employees WHERE department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%T%' )

Question: What are the ids, full names, and salaries for employees making more than average and who work in a department with employees who have the letter J in their first name?
SQL: SELECT employee_id ,  first_name ,  last_name ,  salary FROM employees WHERE salary  >  ( SELECT AVG (salary) FROM employees ) AND department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%J%')