MySQL learning inside and outside connection statements

Source: Internet
Author: User

Noun:

Inner Connection: Natural connection, only two matching rows can be displayed in the result set

Outer connection: Left outer connection, right connection, full outer connection

Inner JOIN, only columns that satisfy the WHERE condition are displayed select a.*,b.* from a inner join B on a.id=b.parent_id

Left outer connection, select a.*,b.* from a LEFT join B on a.id=b.parent_id column is the main, the right table is a secondary table.

Right outer join, select a.*,b.* from a R join B on a.id=b.parent_id left column as secondary table, right table Main table

Full outer JOIN, select a.*,b.* from a full join B on a.id=b.parent_id returns all values of the left and right tables, or NULL when a table has no matching value in a different table

Note: MySQL does not support full join,

Practice Operation: 1, internal connection SELECT Student.name,teacher.high from student INNER JOIN teacher on Student.id=teacher.id;

2. Left outer connection SELECT Student.name,teacher.high from student to teacher on Student.id=teacher.id;

3. Right outer connection SELECT Student.name,teacher.high from student R join teacher on Student.id=teacher.id;

Problems encountered during Operation: 1066th error occurred, just started to be unable to display the same column, the actual statement is missing on

MySQL learning inside and outside connection statements

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.