当前位置:网站首页>[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 :
边栏推荐
- Pat class B "1104 forever" DFS optimization idea
- 从输入URL到页面展示这中间发生了什么?
- Bigvision code
- What happens between entering the URL and displaying the page?
- 2020-01-01t00:00:00.000000z date format conversion
- 将时间戳转为指定格式的时间
- Introduction to mongodb
- Parameter index out of range (1 > number of parameters, which is 0)
- PAT乙级常用函数用法总结
- Docker install MySQL
猜你喜欢
Vs 2019 configuration du moteur de génération de tensorrt
Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)
Use of El tree search method
The idea cannot be loaded, and the market solution can be applied (pro test)
Vs 2019 installation and configuration opencv
softmax的近似之NCE详解
MySql實戰45講【SQL查詢和更新執行流程】
别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
900W+ 数据,从 17s 到 300ms,如何操作
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 05 data input and output
随机推荐
Introduction à mongodb
Destroy the session and empty the specified attributes
BigVision代码
程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
float与0比较
Change and access of median value of listening object
C # webrequest post mode, based on "basic auth" password authentication mode, uploads files and submits other data using multipart / form data mode
Avec trois. JS fait une scène 3D simple
Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)
Model transformation onnx2engine
3D drawing example
New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
从输入URL到页面展示这中间发生了什么?
The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
Gavin teacher's perception of transformer live class - rasa project's actual banking financial BOT Intelligent Business Dialogue robot architecture, process and phenomenon decryption through rasa inte
Mongodb replication set [master-slave replication]
The calculation of stripe, kernel and padding in CNN
Limit of one question per day
解决高并发下System.currentTimeMillis卡顿
redis高级应用【密码防护、数据持久化、主从同步、哨兵模式、事务】【暂未完成(半成品)】