1. Inner join
An inner join combines the columns of two tables (such as A and B) based on a join predicate to produce a new result table
. The INNER JOIN keyword returns rows when there is at least one match in the tables.
Below is a simple use case
The following is the running code and the result
2. Left outer join
Left outer join The Left join keyword will return all rows from the left table, even if there are no matching rows in the right table.
Below is a simple case
Below is the test case
3. Right outer join
The right outer join keyword right join will return all rows from the right table, even if there are no matching rows in the left table.
Below is a simple case
Below is the run and its result
4. Full join
Full join keyword Full join, as long as there is a match in one of the tables, Full join will return rows
The following is a simple case
and the following is the operation and the result
Note that full join is not supported in mysql, but databases such as orcal do.
If you want to use Full join in mysql, the following error will be reported.
Solution: Use both left and right joins
The following is a simple example
5. Cross-connect
Cross-connection is generally used less, and cross-connection is also called Cartesian connection or cross-multiplication connection. If A and B are two sets, their cross-connection is A*B
The following is a simple case