Internal connections:
All records that meet the criteria will appear in the result.
Select Emp.name,dept.addr from emp,dept where emp.deptid=dept.id
->
Select Emp.name dept.addr from emp INNER JOIN dept on Emp.deptid=dept.id
The above two kinds of writing are OK. The second type is formal.
The above SQL is an equivalent connection. In addition to the equivalent connection, there are also non-equivalent connections.
Outer joins:
Records that do not meet the criteria can also appear in the result. The left connection indicates that all the records of the table on the left appear in the result, regardless of whether the condition is met, and that the right connection represents the records of the table on the right that all appear in the result.
MySQL does not support full join. Supports LEFT join and right join. So you can simulate the result of a full join by using the result of the left join in union ALL on the right join.
The table on the left is called the primary table, and the table on the right is called from the table.
In an outer join, all the records for the primary table will be displayed.
Self-Connection:
The self connection is to say a table that connects to itself.
Select T1.name as ' current category ', T2.name as ' parent category '
From the tree T1 the left join the T2 on T1.pid=t2.id
The above example is the self connection.