Mysql concatenation operator _ MySQL

Source: Internet
Author: User
Mysql concatenation operator bitsCN.com

Mysql join operator

1. the effect of the comma-separated JOIN operator is similar to that of inner join:

[SQL]

Select t1. *, t2. * from t1, t2 where t1. I = t2. I;

It is equivalent:

[SQL]

Select t1. *, t2. * from t1 inner join t2 where t1. I = t2. I;

Note that the priority of the comma-separated join operator is different from that of other join types, which sometimes leads to syntax errors, while other join operators do not. Avoid using the comma operator whenever possible.

2. using () clause: it is similar in concept to the on clause and where, but requires that the joined column be of the same name.

For example:

[SQL]

Select t1. *, t2. * from t1 inner join t2 using (I );

It is equivalent:

[Html]

Select t1. *, t2. * from t1 inner join t2 on t1. I = t2. I;

3. how to eliminate auto-join (that is, connecting a data table with itself ).

Aliases are used at this time, for example:

[SQL]

Select m1.name, m2.name from mytable as m1 inner join mytable as m2 where m1.name = m2.name

4. left join and right join (outer join)

The inner join can only display data rows that can be found in two data tables. In addition to displaying the same results, the outer join can also display matching data rows in one data table. The left join operation also displays the rows that do not match the Left Data table in the right data table. Data not found in the right table is NULL.

BitsCN.com

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.