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 are the types of external connections to mysql

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what types of mysql external connections are". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "what type of mysql external connection"!

1. The left outer join keeps the records to be discarded in the left table in the result set, and the corresponding part in the right table is filled with null.

mysql> select a.*, b.* from course as a left join rollcall as b on a.course_id=b.course_id;+-----------+-------------+------+---------+-----------+-----------+------+-----------+------------+--------------+--------------+---------+| course_id | course_name | time | teacher | classroom | t_command | db | course_id | student_id | student_name | teacher_name | command |+-----------+-------------+------+---------+-----------+-----------+------+-----------+------------+--------------+--------------+---------+| 1 | 1234 | 123 | 123 | 123 | 123 | 2 | 1 | 1501010096 |Yu Zongyun | 123 | 123 || 2 | 123 | 123 | 123 | 123 | 123 | NULL | NULL | NULL | NULL | NULL | NULL |+-----------+-------------+------+---------+-----------+-----------+------+-----------+------------+--------------+--------------+---------+

2. Right outer connection, keep the records to be discarded in the right table in the result set, and fill the corresponding part in the left table with null.

mysql> select a.*, b.* from course as a right join rollcall as b on a.course_id=b.course_id;+-----------+-------------+------+---------+-----------+-----------+----+-----------+------------+--------------+--------------+---------+| course_id | course_name | time | teacher | classroom | t_command | db | course_id | student_id | student_name | teacher_name | command |+-----------+-------------+------+---------+-----------+-----------+----+-----------+------------+--------------+--------------+---------+| 1 | 1234 | 123 | 123 | 123 | 123 | 2 | 1 | 1501010096 |Yu Zongyun | 123 | 123 |+-----------+-------------+------+---------+-----------+-----------+----+-----------+------------+--------------+--------------+---------+1 row in set (0.00 sec)

Total outer join: Keep the records to be discarded in the left and right tables in the result set.

The corresponding parts of the right and left tables are filled with nulls.

#Since oracle is not installed on this machine, the correctness of the first sentence of sql is not verified. Select * from table1 full join table2 on table1.C=table2.C At this point, I believe that everyone has a deeper understanding of "what type of mysql external connection". Let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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

Internet Technology

Wechat

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

12
Report