当前位置:网站首页>[MySQL] the difference between left join, right join and join
[MySQL] the difference between left join, right join and join
2022-07-03 03:25:00 【Difficult to know and difficult to Act 1985】
Link query join Regular use , But I haven't fully understood the differences between various usages ,left join、right join、join and inner join And so on join, What's the difference ? The figure of summarizing properties given on the official website :

This picture summarizes all join The difference between , If you just watch , Then I still can't understand it , You must try it yourself .
Set up two tables for connection query , The first table is called kemu, The second table is called score:

1. left join
seeing the name of a thing one thinks of its function , Namely “ Left connection ”, surface 1 Left link table 2, Mainly on the left , Denoted by table 1 Mainly , Associated with the above table 2 The data of , The results show all the data on the left , And then on the right is the data that intersects on the left . as follows :
select *
from kemu
left join score
on kemu.id = score.id
result :
2. right join
“ The right connection ”, surface 1 Right join table 2, Mainly on the right , Denoted by table 2 Mainly , Associated query table 1 The data of , Look up table 2 All the data and tables 1 And table 2 Data with intersection , as follows :
select
*
from
kemu
right join score on kemu.id = score.id
result :
3. join
join, In fact, that is “inner join”, It was written for the sake of brevity join, Two means one , Internal connection , It means the intersection of two tables , It turns out that there is an intersection between the two tables , The rest will not be displayed if there is no connection , This is also used in many cases , as follows
select
*
from
kemu
join score on kemu.id = score.id
result :
边栏推荐
- 模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
- MySQL practice 45 [SQL query and update execution process]
- [mathematical logic] normal form (conjunctive normal form | disjunctive normal form | major item | minor item | maximal item | minor item | principal conjunctive normal form | principal disjunctive no
- 程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
- Lvgl usage experience
- 二维数组中的元素求其存储地址
- MySQL practice 45 lecture [transaction isolation]
- Idea set method call ignore case
- MySql實戰45講【SQL查詢和更新執行流程】
- Using jasmine to monitor constructors - spying on a constructor using Jasmine
猜你喜欢

900W+ 数据,从 17s 到 300ms,如何操作

idea 加载不了应用市场解决办法(亲测)

Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)
![Mongodb replication set [master-slave replication]](/img/2c/8030548455f45fa252062dd90e7b8b.png)
Mongodb replication set [master-slave replication]
![MySQL Real combat 45 [SQL query and Update Execution Process]](/img/cd/3a635f0c3bb4ac3c8241cb77285cc8.png)
MySQL Real combat 45 [SQL query and Update Execution Process]

MySql实战45讲【SQL查询和更新执行流程】

Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf

用Three.js做一个简单的3D场景

The idea cannot be loaded, and the market solution can be applied (pro test)

Idea set method call ignore case
随机推荐
The XML file generated by labelimg is converted to VOC format
模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
Tidal characteristics of the Bohai Sea and the Yellow Sea
程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
Stepping on pits and solutions when using inputfilter to limit EditText
UMI route interception (simple and rough)
Introduction to mongodb
Elsevier latex 提交文章 pdftex.def Error: File `thumbnails/cas-email.jpeg‘ not found: using draf
On the adjacency matrix and adjacency table of graph storage
Ansible简介【暂未完成(半成品)】
softmax的近似之NCE详解
The difference between componentscan and componentscans
C # webrequest post mode, based on "basic auth" password authentication mode, uploads files and submits other data using multipart / form data mode
Vs 2019 configure tensorrt to generate engine
Docker install MySQL
LVGL使用心得
Basic operations of mongodb [add, delete, modify, query]
渤、黄海的潮汐特征
[combinatorics] Application of exponential generating function (multiple set arrangement problem | different balls in different boxes | derivation of exponential generating function of odd / even sequ
Introduction à mongodb