This SQL query selects the department ID, last name of the employee, and last name of each colleague who shares the same department but has a different last name from two tables of employee data joined on department. A second query selects the last name and salary of any employee who reports directly to the manager with the last name 'King'.
This SQL query selects the department ID, last name of the employee, and last name of each colleague who shares the same department but has a different last name from two tables of employee data joined on department. A second query selects the last name and salary of any employee who reports directly to the manager with the last name 'King'.
This SQL query selects the department ID, last name of the employee, and last name of each colleague who shares the same department but has a different last name from two tables of employee data joined on department. A second query selects the last name and salary of any employee who reports directly to the manager with the last name 'King'.
e.department_id department, e.last_name employee, c.last_name colleague from employees e, employees c where e.department_id = c.department_id and e.last_name <> c.last_name;
select last_name, salary
from employees where manager_id in (select employee_id from employees where last_name='King');