In layman's terms:
The number of records connected by A left join B is the same as that of Table.
The number of records connected by A right join B is the same as that of Table B.
A left join B is equivalent to B right join
Table:
Field_K, Field_A
1
3 B
4 c
Table B:
Field_K, Field_ B
1 x
2 y
4 z
Select a. Field_K, a. Field_A, B. Field_K, B. Field_ B
From a left join B on a. Field_K = B. Field_K
Field_K Field_A Field_K Field_ B
----------------------------------------
1 a 1 x
3 B NULL
4 c 4 z
Select a. Field_K, a. Field_A, B. Field_K, B. Field_ B
From a right join B on a. Field_K = B. Field_K
Field_K Field_A Field_K Field_ B
----------------------------------------
1 a 1 x
NULL 2 y
4 c 4 z --
For example:
Assume that the data in Table a and table B is like this.
A B
Id name id stock
1 a 1 15
2 B 2 50
3 c
Select * from a inner join B on a. id = B. id
This syntax is an internal connection in the connection query. The result is:
The matching records of the two tables are displayed in the result list.
According to the preceding table, the result is as follows:
A. id name B. id stock
1 a 1 15
2 B 2 50
----------------------------
Select * from a, B where a. id = B. id
This syntax is another method of writing internal join, and the execution result is the same as that of inner join.
--------------------------------
Select * from a left/right join B on a. id = B. id
This is the left Outer Join or right Outer Join in the outer join syntax.
If it is a left outer join, it will display all records in Table,
Select a. *, B. * from a left join B on a. id = B. id
The query result is as follows:
A. id name B. id stock
1 a 1 15
2 B 2 50
3 c null
--------------------------------------------
If it is a right outer join, it will display all the records in Table B,
Select a. *, B. * from a right join B on a. id = B. id
The query result is as follows:
A. id name B. id stock
1 a 1 15
2 B 2 50
--
Select a. *, B. * from a left join B on a. k = B. k
Select a. *, B. * from a left outer join B on a. k = B. k
---------- The above two types are the same. left join is short for left outer join.
Select a. *, B. * from a left inner join B on a. k = B. k
No such statement. It is a wrong statement.