MySQL RIGHT JOIN
RIGHT JOIN returns all the rows from the right table even if no matching rows have been found in the left table. Its returned null if no row matches the condition on left table.
Syntax
SELECT column_list
FROM table_1
RIGHTJOIN
table_2
ONjoin_condition;
Code language: SQL (Structured Query Language) (sql)
If both tables use the same column to match, you can use the USING clause also
SELECT column_list
FROM table_1
RIGHTJOIN
table_2
USING(column_name)
Example
SELECT r.rollno, r.name, f.fees, f.status
FROM register r
RIGHT JOIN fees f ON r.rollno = f.id;