What is difference between left and right join?
S.no | LEFT JOIN | RIGHT JOIN |
---|---|---|
1. | It gets the records from the rows of the LEFT side linked table and only the matching records from the RIGHT table. | It gets the records from the rows of the RIGHT side linked table and only the matching records from the LEFT table. |
Also Read: MySQL Tricky Interview Questions
BY Best Interview Question ON 17 Apr 2022
Example
1. Left Join
SELECT column_list FROM table_1 LEFT JOIN table_2 ON column_name1 = column_name2 WHERE join_condition
2. Right Join
SELECT column_list FROM table_1 RIGHT JOIN table_2 ON column_name1 = column_name2 WHERE join_condition