当前位置:网站首页>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 .
边栏推荐
- Steady! Huawei micro certification Huawei cloud computing service practice is stable!
- C实现贪吃蛇小游戏
- Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage
- Practical gadget instructions
- AWT常用组件、FileDialog文件选择框
- 如何实现视频平台会员多账号登录
- lightroom 导入图片灰色/黑色矩形 多显示器
- 配置交叉编译工具链和环境变量
- Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?
- After the festival, a large number of people change careers. Is it still time to be 30? Listen to the experience of the past people
猜你喜欢

4G wireless all network solar hydrological equipment power monitoring system bms110

How to get the parent node of all nodes in El tree

APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
![70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment](/img/3f/36a67544deceb3d3789b500efde89c.jpg)
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment

注释与注解

一键过滤选择百度网盘文件

How to avoid JVM memory leakage?

Tf/pytorch/cafe-cv/nlp/ audio - practical demonstration of full ecosystem CPU deployment - Intel openvino tool suite course summary (Part 2)

BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述

Abap:ooalv realizes the function of adding, deleting, modifying and checking
随机推荐
微信小程序使用rich-text中图片宽度超出问题
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
Understanding of cross domain and how to solve cross domain problems
Arc135 C (the proof is not very clear)
JS flattened array of number shape structure
[excel] PivotChart
Install pytoch geometric
How to implement lazy loading in El select (with search function)
Upper computer software development - log information is stored in the database based on log4net
AWT常用组件、FileDialog文件选择框
Abap:ooalv realizes the function of adding, deleting, modifying and checking
卸载Google Drive 硬盘-必须退出程序才能卸载
C实现贪吃蛇小游戏
C realize Snake games
js如何将秒转换成时分秒显示
Input displays the currently selected picture
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
[microservice] Nacos cluster building and loading file configuration
Accidentally deleted the data file of Clickhouse, can it be restored?
Configure cross compilation tool chain and environment variables