MySQL LEFT OUTER JOIN

MySQL LEFT OUTER JOIN

LEFT JOIN returns all the rows from the left table even if no matching rows have been found in the right table. Its returned null if no row matches the condition on right table.

Syntax

SELECT column_list 
FROM table_1 
LEFT JOIN table_2 ON join_condition;

If both tables use the same column to match, you can use the USING clause  also

SELECT column_list 
FROM table_1 
LEFT JOIN table_2 USING (column_name)

Example

SELECT r.rollno, r.name, f.fees, f.status
FROM register r
LEFT JOIN fees f ON r.rollno = f.id;


Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

*

*