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 internal connection, left connection and right connection of database

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

Share

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

This article mainly explains "the difference between the inner connection, the left connection and the right connection of the database". The content in the article is simple and clear, and it is easy to learn and understand. let's study and learn the difference between the inner connection, the left connection and the right connection of the database.

Here to share the various connections to the database.

First create a database with navicat

Create table A, BBJ SQL in the same way

CREATE TABLE `A` (

`Aid` int (10) NOT NULL DEFAULT 1 COMMENT 'Primary key'

`Aname` varchar2

PRIMARY KEY (`id`)

)

ENGINE=InnoDB

DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci

ROW_FORMAT=DEFAULT

The record with select* from An is shown in figure 1 below:

The record with select* from B is shown in figure 2 below:

The relationship between An and B is shown in the figure:

Internal connection (Inner JOIN):

Select* from A JOIN B ON A.Aid=B.Bnameid

Or: select* from A Magi B where A.Aid=B.Bnameid

Running effect

Left connection (Left JOIN):

Select* from A Left JOIN B ON A.Aid=B.Bnameid

Running effect

Right connection (Right JOIN):

Select* from A Right JOIN B ON A.Aid=B.Bnameid

Running effect

Thank you for your reading. The above is the content of "the difference between the inner connection, the left connection and the right connection of the database". After the study of this article, I believe you have a deeper understanding of the difference between the inner connection, the left connection and the right connection of the database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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