In the SQL language, when does a join work, and when does it not? Please give an example to explain. Thank you

Source: Internet
Author: User
Tags joins
Joins are not used when joined, other types of connections must be used.
such as SELECT * from TABLEA INNER JOIN TABLEB on A.id=b.id
It can be written like this:
SELECT * from Tablea,tableb WHERE a.id=b.id

Joins are available in the following categories:

INNER (internal connection)
Specifies that each pair of matching rows is returned. Discards rows that do not match in two tables. If no join type is specified, this is the default setting.
Full (fully connected)
Specifies that the result set contains rows in the left or right table that do not meet the join condition, and the output column corresponding to the other table is set to NULL. This is a supplement to all the rows normally returned by Innerjoin.
Left (connected)

Specifies that all rows in the left table that do not meet the join condition are included in the result set, and that the output column of the other table is set to NULL outside of all rows returned by the inner join.
Right (connected to the left)
Specifies that all rows in the right table that do not meet the join condition are included in the result set, and that the output column corresponding to the other table is set to NULL, except for all rows returned by the inner join.
Cross Join (crossover connection)
The product of the number of records in which the join table conforms to the conditions of the WHERE clause, that is, each record of the first table joins a new record with all records of the other table.
Cross join without an ON clause, other connections must have an ON clause

In the SQL language, when does a join work, and when does it not? Please give an example to explain. Thank you

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.