SQL table connection
Background
In the last self-study subject database system principles, I have gained some knowledge about database table connections. Recently, I used database table connections, let's take a look at it again.
Graph export Summary
First, use a mind map to summarize the content of SQL table join:
After having a rough understanding of SQL table join, let's take a further look at it through a small example. First, I create two tables:
External Connection
External connections include left outer connections, right outer connections, and full outer connections.
Left Outer Join
SQL statement: select * from table1 left join table2 on table1.id = table2.id
Outer right connection
SQL statement: select * from table1 right join table2 on table1.id = table2.id
Complete connection
SQL statement: select * from table1 full join table2 on table1.id = table2.id
Internal Connection
SQL statement: select table1.id, table2.score from table1 inner join table2 on table1.id = table2.id
Cross join
SQL statement: select * from table1 cross join table2 on table1.id = table2.id
In fact, learning is like this. At the same time, through review, each time there will be different gains, a little deeper understanding.