当前位置:网站首页>SQL join, left join, right join usage
SQL join, left join, right join usage
2022-07-04 06:11:00 【Game programming】
SQL Join Used to combine rows from two or more tables , Based on the common fields between these tables .
INNER JOIN: If there is at least one match in the table , Then go back to the line
LEFT JOIN: Even if there is no match in the right table , Also returns all rows from the left table
RIGHT JOIN: Even if there is no match in the left table , Also returns all rows from the right table
FULL JOIN: As long as there is a match in one of the tables , Then go back to the line
grammar
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;
perhaps :
SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;
INNER JOIN And JOIN It's the same .
Refer to the figure below :

LEFT JOIN Keywords from the left table (table1) Go back to all the lines , Even if the right watch (table2) There is no match in . If there is no match in the right table , The result is NULL.
grammar
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
or :
SELECT column_name(s)
FROM table1
LEFT OUTER JOIN table2
ON table1.column_name=table2.column_name;
In some databases ,LEFT JOIN be called LEFT OUTER JOIN.
RIGHT JOIN Keywords from the right table (table2) Go back to all the lines , Even if the left watch (table1) There is no match in . If there is no match in the left table , The result is NULL.
grammar
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;
or :
SELECT column_name(s)
FROM table1
RIGHT OUTER JOIN table2
ON table1.column_name=table2.column_name;
In some databases ,RIGHT JOIN be called RIGHT OUTER JOIN.
FULL OUTER JOIN Key words only need left table (table1) And the right watch (table2) There is a match... In one of the tables , Then go back to the line .
FULL OUTER JOIN Keywords combine LEFT JOIN and RIGHT JOIN Result .
grammar
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name=table2.column_name;
FULL OUTER JOIN Keyword returns all rows in the left and right tables . If table1 The rows in the table are in table2 There is no match or table2 The rows in the table are in table1 There is no match in the table , These lines will also be listed .
author :Ritchie_Li
this paper [ SQL Join,Left Join,Right Join usage ] Included in Game programming ️ - database , A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome browser .
边栏推荐
- Gridview出现滚动条,组件冲突,如何解决
- 检漏继电器JY82-2P
- Halcon image calibration enables subsequent image processing to become the same as the template image
- How to clone objects
- Weekly summary (*63): about positive energy
- Detectron:训练自己的数据集——将自己的数据格式转换成COCO格式
- [Chongqing Guangdong education] electronic circuit homework question bank of RTVU secondary school
- QT 获取随机颜色值设置label背景色 代码
- HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
- Tf/pytorch/cafe-cv/nlp/ audio - practical demonstration of full ecosystem CPU deployment - Intel openvino tool suite course summary (Part 2)
猜你喜欢
随机推荐
Tutle clock improved version
对List进行排序工具类,可以对字符串排序
webrtc 快速搭建 视频通话 视频会议
Component、Container容器常用API详解:Frame、Panel、ScrollPane
JS扁平化数形结构的数组
lightroom 导入图片灰色/黑色矩形 多显示器
AWT introduction
Average two numbers
How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?
Input displays the currently selected picture
Actual cases and optimization solutions of cloud native architecture
Arc135 C (the proof is not very clear)
Nexus 6p downgraded from 8.0 to 6.0+root
MySQL的information_schema数据库
Recommended system 1 --- framework
Take you to quickly learn how to use qsort and simulate qsort
C语言练习题(递归)
Distributed cap theory
LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout
如何实现视频平台会员多账号登录








![[untitled]](/img/32/cfd45bb5e8555ea2ad344161370dbe.png)
