Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The difference between internal connection, left connection and right connection of database

Shulou Source: shulou.com Published: 2022-06-02 06:50:33 10月03日 Update

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!

Tags: Data database situation effect learning operation content that is ideas articles more knowledge knowledge points articles follow questions such as pictures practice push research Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Information Huawei Shulou Tech Info Shulou Technology