Background
In the last self-examination subject "Database system Principle", has contacted about the database table connection some knowledge, the recent learning process and used in the database table connection problem, take this again with you to review.
Guide Drawing Summary
First, use a mental map to summarize the contents of the SQL table connection:
After a general understanding of the SQL table connection, let's learn about it in a small example. First, I set up and two tables: as follows
Outer Joins
Outer joins include left outer joins, right outer joins, and full outer joins.
Left OUTER JOIN
SQL statement: SELECT * FROM table1 LEFT join table2 on Table1.id=table2.id
Right outer join
SQL statement: SELECT * FROM table1 right join table2 on Table1.id=table2.id
Full connection
SQL statement: SELECT * FROM table1 full join table2 on Table1.id=table2.id
INNER JOIN
SQL statement: Select Table1.id,table2.score from table1 inner join table2 on Table1.id=table2.id
Cross Connect
SQL statement: SELECT * FROM table1 Cross join table2 on Table1.id=table2.id
In fact, learning is such, repeatedly, at the same time through the review process in time each will have different harvests, a little deeper understanding.