SQL -Structured Query Language - SQL Joins - Right Join Tutorial
Right Join or Right Outer Join is used to retrieve all the records from the right table ( table which is mentioned second – table2) and the records that are matched from the left table( table which is mentioned first – table1).
We can perform the right joins in multiple tables.
The syntax for right joins is-
table_1 RIGHT JOIN table_2
table_1.column_name = table_2.column_name;
employees.employee_id = job_history.employee_id;
Better to use AS (Alias) for the long table name-
employees as e
job_history as jh
e.employee_id = jh.employee_id;
Here we will get all records from the right table (job_history) and only those records where id will get matched in both employees and job_history table.
Another record that is not matched in the left table (table1) will not get retrieved.
Best learning portal that provides you great learning experience of various technologies with modern compilation tools and technique
Don't hesitate to give us a call or send us a contact form message