SQL connection queries

Source: Internet
Author: User

10:37:10 | category:
technical article | Tag:
| font size large medium small subscription

 1. When two tables in natural join are connected through natural join, it is equivalent to an implicit WHERE clause. Compare the corresponding columns with the same name in two tables to see if they are equal. 2. Cross join (create Cartesian Product) generates the third table that returns the result set for the two tables through cross join. It is equivalent to a normal connection. 3. Inner join (inner join) Internal join is equivalent to normal cross join, but the format is different. Inner join has a Search Condition for the on clause (equivalent to where) following it, used to filter returned rows. 4. Select * from Ta Outer Join TB on (TA. c1 = TB. c1) Outer Join tells the DBMS to generate the result table, which not only has correlation (TA. c1 = TB. c1), and there are non-matched rows from any of the two source tables. 5. left Outer Join (left join) Right Outer Join (right join) Select * from Ta left Outer Join TB on (TA. c1 = TB. c1) Select * from Ta right Outer Join TB on (TA. c1 = TB. c1) left Outer Join (left join) tells DBMS to generate a result table that includes union rows and any unmatched rows, however, the unmatched rows are from the table on the left of the left Outer Join keyword in the from clause of the query. Right Outer Join (right join) is the opposite of left Outer Join (left join. 6. Full outer join (full join) Full outer join returns the tables that combine the left Outer Join and right Outer Join results. 

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.