SQL join outer JOIN INNER JOIN full join cross Join

Source: Internet
Author: User
Tags joins

Joins are divided into:

INNER JOIN???????????????????????? [INNER JOIN]

Outer JOIN???????? (left outer join, right outer join)???????? [Left Join/left outer joins, right join/right outer JOIN]

Full Join???????????????????? [Full JOIN]

Cross Join???????????????????? [Cross Join]

Table A???? Id???? Ebcid???? Name???????? Table B???? Uid???? Ebcid

???? 1???? 1???? Aa???????????? 1???? 1

???? 2???? 2???? Bb???????????? 1???? 2

???? 3???? 3???? Cc???????????? 1???? 3

???? 4???? 4???? Dd???????????? 2???? 2

???? 5???? 5???? Ee???????????? 2???? 3

Inner joins

Select A.*, b.* from a inner join B on a.ebcid = B.ebcid

Results:

1???? 1???? Aa???? 1???? 1

2???? 2???? Bb???? 1???? 2

3???? 3???? Cc???? 1???? 3

2???? 2???? Bb???? 2???? 2

3???? 3???? Cc???? 2???? 3

?

Left OUTER JOIN

Select A.*, b.* from a LEFT join B on a.ebcid = B.ebcid

1???? 1???? Aa???? 1???? 1

2???? 2???? Bb???? 1???? 2

2???? 2???? Bb???? 2???? 2

3???? 3???? Cc???? 1???? 3

3???? 3???? Cc???? 2???? 3

4???? 4???? Dd

5???? 5???? Ee

?

Right outer join (the right table is the main, example is not typical ~ ~)

Select A.*, b.* from a right join B on a.ebcid = B.ebcid

1???? 1???? Aa???? 1???? 1

2???? 2???? Bb???? 1???? 2

3???? 3???? Cc???? 1???? 3

2???? 2???? Bb???? 2???? 2

3???? 3???? Cc???? 2???? 3

?

Full Join

It's all around.

Cross Join (Cartesian product)

SQL join outer JOIN INNER JOIN full join cross Join

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.