It is estimated that many people will be confused by various types of table connections when they are learning SQL table connections, and now, with the diagram below, it is possible to visually differentiate tables from each other.
Can be seen through the graph
Multi-table queries are divided into internal and external connections
The outer joins are left-connected (either to the right join or to the outer join), to the connection to the starboard join, or to the outer join, and to the full outer join (either the complete join or the outer join)
The result of a LEFT join (left JOIN, or outer join) is that all rows of the leftmost table in the RIGHT join clause, not just the rows that match the linked column, and if a row in the left table does not match in the right table, all selection columns in the table in the associated result row are null values (NULL)
SQL Syntax select * FROM table1 left joins table2 on table1. Condition column name = table2. Condition column name;
Note: All columns and matching columns are displayed in the Table1
Right-join--outer join is not a long way to say this left connection is very much like but the opposite, just say the syntax
Select *from table1 right joins table2 on Table1. Condition column = table2. Condition column
Complete external connection (full join or outer join)
Displays all rows in the left and right table, and when there is no matching row in one table, the selection list column of the other table contains a null value (NULL) if there is one, all data is displayed
SQL syntax:
Select *from table1 full join table2 on table1. Condition column name = table2. Condition Column Name
Internal connection:
Concept: An inner join is a comparison operator that compares the connection to the value of a connection column
INNER JOIN (join or INNER join)
SQL syntax:
Select *fron table1 join table2 on table1. Condition column name = table2. Condition Column Name
Returns two table columns that match the matching criteria
Equivalent to:
Select a *, b* from table1 A, table2 B where A. Condition column name =b. Condition Column Name
Select *form table1 Cross join table2 where table1. Condition column name = table2. Condition column Name (note: The Cross join cannot be followed by on with where)
Cross Connect (Full)
Concept: A cross join without a WHERE clause will result in the number of rows in the first table of the Cartesian product involved in the connection, multiplied by the number of rows in the second table equal to the Cartesian product and the size of the result set
Cross-Joins: crosses join (without a condition where if the band Returns or shows the number of matching rows)
SQL syntax:
Select *from table1 Cross join Table2
If there is a condition (where)
SELECT * FROM table1 cross join Table2 where table1. Condition column name = table2. Condition Column Name
Equivalent to
Select *from table1,table2 (without where)
SQL table join diagram: various connection diagrams