Right outer join (or right join) is used to join more than one table where we want all records from the right table (the table that comes last in the query) and only matching records from left table (table name that comes first in the query).
To demonstrate this example, we have two tables as shown below
Now run the following SQL statement in the query window.
SELECT pd.PersonalDetailsId, pd.FirstName, pd.LastName, pd.Age, ac.NetSalary FROM PersonalDetails pd RIGHT JOIN Accounts ac ON pd.PersonalDetailsId = ac.PersonalDetailsId
Here, instead of LEFT JOIN, we have used RIGHT JOIN that changes the result based on right side table data. So it will give all records from Accounts table and only matching records from the PersonalDetails table.
Views: 4331 | Post Order: 37