Connection Classification Connections between relationships are divided into inner joins (inner join) and outer joins (outer joins).
Outer joins can be divided into: Left outer join,right outer JOIN and full outer join.
Internal Connection calculation method: The Cartesian product will be produced if the condition is not added;
If you have a join condition, follow the rules for the next section, "Join conditions," and the qualifying tuples are placed in the resulting relationship.
Left outer JOIN calculation process: 1) Calculating the inner connection under the same connection condition, putting the eligible tuples into the result relation;
2 If there is a tuple in the left relationship that does not meet the condition, put it into the result relationship and the remainder is filled with null
Right outer JOIN calculation process: 1) Calculating the inner connection under the same connection condition, putting the eligible tuples into the result relation;
2 If the right relationship has a tuple does not meet the conditions, put it into the result relationship, the remainder of the rest with null
Full outer JOIN 1) Calculating the inner connection under the same connection condition, putting the eligible tuples into the result relation;
2 If there is a tuple in the left and right relationship, it is put into the result relationship and the remainder is filled with null.
As used to modify the relationship name and property name of the resulting relationship after the connection.
Join Condition The connection between the relationships can be conditional, the outer join must be conditional, the INNER join if not add conditions will produce Cartesian product.
What are the connection conditions?
Natural--
1) The values of all properties with the same name in two relationships (left and friends) are equal.
2) Natural always appear in front of the join statement
3 in the result relationship of natural, a property of the same name appears only once
4 in the result relationship of natural, the order of attributes is always in accordance with the principle of precedence of the left relationship.
5 in MySQL, natural join cannot use on to specify additional query criteria
on--
1) on is used behind the join statement
2) on the following use relationship 1. Attribute a= relation 2. The predicate-word method of attribute B
using--
1) is similar to natural, just explicitly specifying the property name
2 If the using also specifies all attributes of the same name, then the same as natural
Mysql
In MySQL, the natural join and left OUTER join cannot be used at the same time, you can first make a view of the natural join statement, and then use the left outer join
Join defaults to INNER JOIN
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.