programming-examples/sql/JoinHRDatabase/4. Write a query in SQL to display the first name, last name, department number and department name, for all employees for departments 80 or 40.sql

9 lines
432 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*4. Write a query in SQL to display the first name, last name, department number and department name, for all employees for
departments 80 or 40. */
SELECT E.first_name , E.last_name ,
E.department_id , D.department_name
FROM employees E
JOIN departments D
ON E.department_id = D.department_id
AND E.department_id IN (80 , 40)
ORDER BY E.last_name;