SQL table Connection

Source: Internet
Author: User
Tags join joins

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.