Back to Browse

(SQL Tutorial #15) How LEFT and RIGHT OUTER joins work? | LEFT OUTER JOIN vs RIGHT OUTER JOIN

18 views
May 5, 2020
8:09

Learn how LEFT and RIGHT OUTER joins work. Learn the difference between LEFT OUTER JOIN and RIGHT OUTER JOIN. ► LEFT OUTER JOIN Returns all records from the left table, and the matched records from the right table. ► RIGHT OUTER JOIN Returns all records from the right table, and the matched records from the left table. ► Queries used in this video: ►LEFT OUTER JOIN 1. Display employees' first name, Last name, department id and all departments including those where do not have any employee. select e.first_name, e.last_name, e.department_id, d.department_name from departments d left outer join employees e on d.department_id=e.department_id; 2. Display employees' first name, Last name department id and all departments including those where do not have any employee where department name is not equal to ‘Marketing’. select e.first_name, e.last_name, e.department_id, d.department_name from hr.departments d left outer join hr.employees e on d.department_id=e.department_id where d.department_name != 'Marketing'; ►RIGHT OUTER JOIN 3. Display the first name, last name, department number, and name, for all employees who have or have not any department select e.first_name, e.last_name, e.department_id, d.department_name from departments d right outer join employees e on d.department_id=e.department_id; 4. Display the first name, last name, department number, and name, salary for all employees who have department or have not any department where the salary is more than 15000 select e.first_name, e.last_name, e.department_id, d.department_name, salary from hr.departments d right outer join hr.employees e on d.department_id=e.department_id where e.salary ▶️ 15000; ***▶️ means greater than & ◀️ means less than*** ► This video is a part of SQL for Beginners Tutorial series. ► See the PLAYLIST to learn more about SQL commands: https://www.youtube.com/playlist?list=PLArhmGag-BWoPLN8vNw9fPlHPwAVvN-hG 👍👍 👍PLEASE LIKE & SHARE THIS VIDEO with your friends to support us grow! 🔔🔔 🔔DON'T FORGET TO SUBSCRIBE to watch future tutorials https://www.youtube.com/channel/UCMEzw1tTTLLssZSVNPA18aQ TURN ON THE 🔔 BELL ICON TO GET UPDATES FIRST!📩📩📩 #leftOuterJoinSql #rightOuterJoinSql

Download

0 formats

No download links available.

(SQL Tutorial #15) How LEFT and RIGHT OUTER joins work? | LEFT OUTER JOIN vs RIGHT OUTER JOIN | NatokHD