SQL table connection basic syntax and SQL connection basic syntax

Source: Internet
Author: User

SQL table connection basic syntax and SQL connection basic syntax

SQL connections can be divided into internal connections, external connections, and cross connections.

1. Inner join: the inner join query operation lists the data rows that match the connection condition. It uses the comparison operator to compare the column values of the connected columns.

1.1 select * from Table1 as a, Table2 as B where a. id = B. id

1.2 select * from Table1 as a inner join Table2 as B on a. id = B. id

2.3 Full join (when a row does not match a row in another table, the selection list column of the other table contains a null value. If there are matched rows between tables, the entire result set row contains the data value of the base table)

Select * from Table1 as a full outer join Table2 as B on a. id = B. id

3. Combine each row in the left table with all rows in the right table. Cross join is also called Cartesian product.

Select * from Table1 as a cross join Table2 as B order B a. id

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.