MariaDB RIGHT OUTER JOIN

MariaDB RIGHT OUTER JOIN is used to return all rows from right-hand table specified in the ON condition and only those rows from the other table where the joined fields are satisfied the conditions.

MariaDB RIGHT OUTER JOIN is also called RIGHT JOIN.

Syntax:


SELECT columns
FROM table1
RIGHT [OUTER] JOIN table2
ON table1.column = table2.column; 

Image representation:

MariaDB Right outer join 1

Example:


SELECT Students.student_id, Students.student_name, 
Students.student_address, Employee2.salary, 
Employee2.emp_address
FROM Students 
RIGHT JOIN Employee2
ON Students.student_id = Employee2.emp_id;

Output:

MariaDB Right outer join 2