Seven connection queries of Mysql

1. Database structure

Insert picture description here


Insert picture description here


2. sql execution order

Insert picture description here


Insert picture description here


Insert picture description here


1. Inner join query
Display the common information of table A and table B, which is equivalent to taking the intersection.

Insert picture description here

2. Left join query
displays all the information of the left table (A table), the right table (B table) only displays the information that meets the conditions, and does not display null

Insert picture description here


3. The right join query
displays all the information of the right table (B table), the left table (Table A) Only the information that meets the conditions is displayed, and null is not displayed

Insert picture description here

4. Left join query, only display information unique to the left table.
Equivalent to: left join result set-inner join result set

Insert picture description here


5. Right join query, only display information unique to the right table.
Equivalent to: right join result set-inner join result set

Insert picture description here


6.
There is no FULL OUTER JOIN in mysql for full connection query , so UNION is
equivalent to: left connection result set + right connection result set

Insert picture description here


7. After the full join query, only the specific parts of the left and right tables are displayed
. There is no FULL OUTER JOIN in mysql, so UNION is
equivalent to: full join result set-inner join result set

Insert picture description here