A (Id,name)
Data: (1, Zhang San) (2, John Doe) (3, Harry)
B (Id,name)
Data: (1, student) (2, teacher) (4, principal)
Left JOIN Connection results:
Select a.*,b.* from A left join B on A.id=b.id;
1 31 Students
2 Li 42 teacher
3 Harry NULL NULL
Right link result:
Select a.*,b.* from A right join B on a.id=b.id;
1 31 Students
2 Li 42 teacher
Null NULL 4 Principal
****************
Add: The following situation will be used outside the connection
For example, there are two tables, one is the user table, the other is the transaction table, if I want to query each user's transactions will need to use the left outer connection, because not every user has a transaction record.
After you use the left outer connection, the information for the transaction will be displayed, and nothing will show null, as I have shown in the example above.
If there is no external connection, such as "Harry" There is no transaction record, then the user table "Harry" information will not be displayed, lost the query all user transaction significance.
****************
Look at the results to understand the difference between the left and right connections.
Difference and application of left and right outer connections