当前位置:网站首页>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 .
边栏推荐
- 安装 Pytorch geometric
- Nexus 6p从8.0降级6.0+root
- [untitled]
- Design and implementation of tcp/ip series overview
- Yiwen unlocks Huawei's new cloud skills - the whole process of aiot development [device access - ESP end-to-side data collection [mqtt]- real time data analysis] (step-by-step screenshot is more detai
- Arc135 a (time complexity analysis)
- gslb(global server load balance)技术的一点理解
- 一键过滤选择百度网盘文件
- The end of the Internet is rural revitalization
- Learning multi-level structural information for small organ segmentation
猜你喜欢

Abap:ooalv realizes the function of adding, deleting, modifying and checking

Component、Container容器常用API详解:Frame、Panel、ScrollPane

分布式CAP理论

InputStream/OutputStream(文件的输入输出)

JSON Web Token----JWT和傳統session登錄認證對比

509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费

Leetcode question brushing record | 206_ Reverse linked list

gslb(global server load balance)技术的一点理解

JS how to convert seconds into hours, minutes and seconds display

APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
随机推荐
198. House raiding
JS arguments parameter usage and explanation
Impact relay jc-7/11/dc110v
How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
C réaliser des jeux de serpents gourmands
复合非线性反馈控制(二)
4G wireless all network solar hydrological equipment power monitoring system bms110
注释与注解
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
Accidentally deleted the data file of Clickhouse, can it be restored?
Take you to quickly learn how to use qsort and simulate qsort
ANSYS command
el-select如何实现懒加载(带搜索功能)
Install pytoch geometric
【无标题】
Manually page the list (parameter list, current page, page size)
2022.7.2-----leetcode.871
lightroom 导入图片灰色/黑色矩形 多显示器
How to solve the component conflicts caused by scrollbars in GridView
Steady! Huawei micro certification Huawei cloud computing service practice is stable!