Database: hr_1

Question: What are the employee ids and job ids for employees who make less than the lowest earning employee with title MK_MAN?
SQL: SELECT employee_id ,  job_id FROM employees WHERE salary  <  ( SELECT min(salary) FROM employees WHERE job_id  =  'MK_MAN' )

Question: What are the employee ids, full names, and job ids for employees who make more than the highest earning employee with title PU_MAN?
SQL: SELECT employee_id ,  first_name ,  last_name ,  job_id FROM employees WHERE salary  >  ( SELECT max(salary) FROM employees WHERE job_id  =  'PU_MAN' )

Question: What are total salaries and department id for each department that has more than 2 employees?
SQL: SELECT department_id ,  SUM(salary) FROM employees GROUP BY department_id HAVING count(*)  >=  2

Question: What is all the information about employees who have never had a job in the past?
SQL: SELECT * FROM employees WHERE employee_id NOT IN (SELECT employee_id FROM job_history)

Question: What are the full names, departments, cities, and state provinces for each employee?
SQL: SELECT T1.first_name ,  T1.last_name ,  T2.department_name ,  T3.city ,  T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id

Question: What are the full names and cities of employees who have the letter Z in their first names?
SQL: SELECT T1.first_name ,  T1.last_name ,  T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id WHERE T1.first_name LIKE '%z%'

Question: What are the department names, cities, and state provinces for each department?
SQL: SELECT T1.department_name ,  T2.city ,  T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id  =  T1.location_id

Question: What the full names, ids of each employee and the name of the country they are in?
SQL: SELECT first_name ,  last_name ,  employee_id ,  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 the department names and how many employees work in each of them?
SQL: SELECT department_name ,  COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id GROUP BY department_name

Question: What are full names and salaries of employees working in the city of London?
SQL: SELECT first_name ,  last_name ,  salary FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN  locations AS T3 ON T2.location_id  =  T3.location_id WHERE  T3.city  =  'London'