Mysql connection query one pot end series

Inscription

This article will share the understanding of all connection queries in mysql and the writing of sql (the foreign key is not set in the database)

Connect query

Internal connection

The inner join is to query the common part of the two tables, which is equivalent to the'and' operation. The sql statement is as shown in the figure below, the text version is not given, you can write it by yourself.
Insert picture description here

search result
Insert picture description here

Left outer join

Insert picture description here
search result:
Insert picture description here

Insert picture description here
search result
Insert picture description here

Right outer join

Insert picture description here
Query result
Insert picture description here
Insert picture description here
Query result
Insert picture description here

Fully connected

The full connection of mysql is executed through the left and right outer join queries of union
Insert picture description here

Query result
Insert picture description here
Insert picture description here
Query result
Insert picture description here

Guess you like

Origin blog.csdn.net/TreeCode/article/details/108356817