Connections between tables and tables

Source: Internet
Author: User

Why joins between tables and tables : because the information in a single table is incomplete and requires more complete information in other tables, there is a connection between tables and tables

INner join (inner join) , can be abbreviated as: Join

Explanation: INNER join (equivalent join) returns only rows with the same join field in two tables

left OUTER join (Zuo Connection), abbreviated as: Ieft join

Explanation: The LEFT join returns records that include all the records in the left table and the equivalent of the junction fields in the right table

right outer join, abbreviated to join

Explanation: Right join returns records that include all records in the right table and the junction fields in the left table

INNER Join Connection Database usage

INNER join joins two data table usage:

SELECT * FROM table 1 INNER JOIN table 2 on table 1. Field number = Table 2. Field number

INNER join joins three data table usage:

SELECT * FROM (table 1 INNER join table 2 on table 1. Field number = Table 2. Field number) INNER JOIN table 3 on table 1. Field number = Table 3. Field number

Multiple tables can be connected, in the same format as the three tables connected, extrapolate

Things to consider when entering commands

1, in the process of entering letters, we must use the English half-width punctuation marks, the words left half the space between the corners;
2. When creating a data table, if a table joins multiple tables, the field in this table must be a number data type, and the same field in multiple tables must be the primary key, and the AutoNumber data type. Otherwise, it is difficult to join successfully.
3, code nesting Quick Method: For example, if you want to connect five tables, as long as the code to connect four tables with a front and back brackets (the front parenthesis added to the end of the code), and then continue to add after the parentheses after the "INNER JOIN table name x on table 1." Field number = table X. Field number "Code, so you can join the data table indefinitely:)

Connections between tables and tables

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.