SQL Right Join
A RIGHT JOIN
(or RIGHT OUTER JOIN
) returns all rows from the right table and the matching rows from the left table. If there are no matches, NULL values are returned for the columns from the left table.
Example: Using RIGHT JOIN
SELECT Events.EventName, FreedomFighters.Name
FROM Events
RIGHT JOIN FreedomFighters ON Events.FighterID = FreedomFighters.FighterID;
Output:
EventName | Name |
---|---|
Dandi March | Mahatma Gandhi |
INA Formation | Subhas Chandra Bose |
Lahore Protest | Bhagat Singh |
Battle of Jhansi | Rani Lakshmi Bai |