Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The difference between inner connection and outer connection

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Connections to SQL databases: internal connections, and external connections (left outer connection, right outer connection, and full connection)

This experiment is carried out in the MySQL database, and the initial table of the database is as follows

First, internal join: the result contains only the rows in the two tables that meet the join criteria. As follows

Second, outer join: the result contains rows that meet the criteria, while rows that do not meet the criteria (divided into left outer join, right outer join and full outer join)

1. Left outer join: all rows in the left table + matching rows in the right table. If a row in the left table does not match in the right table, NULL is displayed. As follows:

2. The right outer connection is opposite to the left outer connection. As follows:

3. Full external connection: no matter whether the match is matched or not, all are displayed. The left table does not show NULL on the right, and the right table does not show NULL on the left.

The MySQL database does not support full external connections, so a syntax is changed, which is originally written:

Select * from student full join score on student.sno=score.sno

)

Cross join: returns the combination of all rows in the left table and all rows in the right table, also known as Cartesian product

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report