1.left join literally, the left hand, is based on left table, and the right table is joined by the corresponding field's connection.
Table A
ID Name
1 sheets of three
2 John Doe
3 Harry
4 Xiao Chen
b table
ID Job
1 cooks
2 Teachers
3 workers
5 Engineer
SELECT * from a LEFT join B on a.id=b.id
The result is this:
ID Name ID Job
1 sheets of 31 cooks
2 Li 42 Teacher
3 Kings 53 workers
4 Xiao Chen null null
The left join is displayed in all, and the right table shows the fields and values that match, and the null display is not matched.
---------------------------------------------------------------------------------------------------------------
2.right Join
Right join literally, that is, to be handed, is based on the right table, and the left table is joined by the corresponding field connection.
Also take the example above:
SELECT * from a LEFT join B on a.id=b.id
The displayed results are conceivable:
ID Name ID Job
1 sheets of 31 cooks
2 Li 42 Teacher
3 Kings 53 workers
Null NULL 5 Engineer
Right joins are all displayed on the table, and the left table shows the fields and values that match, and the null display is not matched.
-------------------------------------------------------------------------------------------------------------
3.inner joins literally, that is, intra-intersection, within the link. The intra-intersection is performed by connecting an equality field.
Still take the above example as an example:
SELECT * from a Inner join B on a.id=b.id
The result is this:
ID Name ID Job
1 sheets of 31 cooks
2 Li 42 Teacher
3 Kings 53 workers
The inner join is not matched by the left and right tables, but by the equivalent fields to link the values to form the table.
-----------------------------------------------------------------------------
In real-world applications, the inner join is much faster than the left join and right join, but the specific usage situation depends on the data requirements.
Left joins, right joins, how are inner joins all handed?