Database notes,

Source: Internet
Author: User

Database notes,

NOTE Records:

========================================================== ====

Left Outer join

Involved tables: student, student, and fee_info:

Two table applications:

Query 1:

Query 2:

The difference can be seen from the comparison. query 2 is more than query 1. One Fengjie record (s. number of this record does not have the corresponding f. feeId)
Query 1: when the corresponding f. feeId cannot be found in s. number, this record is automatically filtered out.

Query 2: The Outer join uses left join and queries the main table s. When the corresponding f. feeId cannot be found in s. number, it is also queried.

 

Three table applications:

Query 1:

Query 2:

At this time, it is the association of three tables. It is similar to the association of two tables.

The difference can be seen from the comparison. query 2 is more than query 1. One Fengjie record (s. number of this record does not have the corresponding f. feeId)

Query 1: when the corresponding f. feeId cannot be found in s. number, this record is automatically filtered out.

Query 2: The Outer join uses left join and queries the main table s. When s. number cannot find the corresponding f. feeId, f. when the corresponding objId cannot be found for ojbId, it will also be queried.

========================================================== ============================================

Union table join

Condition for using union: The field type and number of fields must be the same.

Involved table: A table test_union, in sequence as follows:

Application: remove records with duplicate data and empty address (records in the red box in the figure)

1 ):

2 ):

3): splice tables in steps 1 and 2

The result is the desired result. It is successful .............................

 

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.