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

What do mysql Chinese and foreign links refer to?

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

Share

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

Editor to share with you what mysql Chinese and foreign links refer to. I hope you will gain a lot after reading this article. Let's discuss it together.

Mysql foreign join refers to the use of comparison operators to compare the data in two tables. The join result contains not only rows that meet the join conditions, but also rows that do not meet the conditions. The fields that do not meet the conditions are shown as null; outer joins, which are divided into left outer joins and right outer joins.

Inner join (Inner Join), also known as simple join or natural join, is a common join query. The inner join uses the comparison operator to compare the data in the two tables and lists the data rows that match the join conditions to form a new record. In other words, in the inner join query, only the records that meet the criteria can appear in the query results.

In the inner join query, the returned results contain only the data that meets the query conditions and join conditions, but sometimes it is necessary to include unrelated data, that is, the returned results contain not only the qualified data, but also all the data in the left table (left join, left outer join) or right table (right join or right outer join) or two tables (full outer join).

Mysql external connection is divided into left outer connection and right outer connection; full external connection is not supported.

The syntax format of external connection is as follows:

Fields looked up by select from Table 1 left | right [outer] join Table 2 on Table 1. Relation field = Table 2. The relation field where condition includes the left outer join, the right outer join, and the full outer join.

Note the use of left join. The table to the left of the right join keyword is called the left table, and the table to the right of the keyword is called the right table.

1. Left outer connection

Take the table on the left as the base table and display all the rows and columns of the base table. If the conditions do not match, all fields in the table will be displayed as null.

Select * from TestA a left join TestB b on a.id=b.id

two。 Right outer connection

Take the table on the right as the base table and display all the rows and columns of the base table. If the conditions do not match, all fields in the table will be displayed as null

Select * from TestA a right join TestB b on a.id=b.id

After reading this article, I believe you have a certain understanding of what mysql Chinese and foreign links refer to. Want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!

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

Database

Wechat

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

12
Report