当前位置:网站首页>Multi table operation - external connection query
Multi table operation - external connection query
2022-07-04 19:41:00 【Soup key TJ】
Catalog
- External connection query is divided into left external connection query and right external connection query
- Take a table as Lord , Take out all the records in it , Then each one is joined to another table , Whether or not you can match the conditions , In the end, they will keep
- Can match , Keep it right ; Can't match , The fields of other tables are empty (null), Called external connection
The left outer join
- Query principle
- Query all the data in the left table , And the left and right tables have the intersection part of the data
- The query syntax
- select Name from Table name 1 left [outer] join Table name 2 on Conditions
Right connection
- Query principle
- Query all the data in the right table , And the left and right tables have the intersection part of the data
- The query syntax
- select Name from Table name 1 right [outer] join Table name 2 on Conditions
Example operation
- Please click to view the data preparation of the table
- The left outer join
- Query all user information , And the corresponding order information of the user
-- The left outer join -- Query all user information , And the corresponding order information of the user SELECT u.*, o.number FROM user u LEFT OUTER JOIN orderlist o ON o.uid=u.id;
- Right connection
- Query all order information , And the user information of the order
-- Right connection -- Query all order information , And the user information of the order SELECT o.*, u.name FROM user u RIGHT OUTER JOIN orderlist o ON o.uid=u.id;
边栏推荐
- 记一次 .NET 某工控数据采集平台 线程数 爆高分析
- Wechat reading notes of "work, consumerism and the new poor"
- Pytest 可视化测试报告之 Allure
- HDU 1097 A hard puzzle
- 联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点
- Online text line fixed length fill tool
- Hough transform Hough transform principle
- 在线文本行固定长度填充工具
- Educational codeforces round 22 E. Army Creation
- Stream流
猜你喜欢
To sort out messy header files, I use include what you use
How to use async Awati asynchronous task processing instead of backgroundworker?
“只跑一趟”,小区装维任务主动推荐探索
Stream流
Pythagorean number law (any three numbers can meet the conditions of Pythagorean theorem)
如何使用Async-Awati异步任务处理代替BackgroundWorker?
FPGA时序约束分享01_四大步骤简述
node_ Exporter deployment
记一次 .NET 某工控数据采集平台 线程数 爆高分析
Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?
随机推荐
Niuke Xiaobai month race 7 who is the divine Archer
Shell 编程核心技术《二》
函数式接口
Educational Codeforces Round 22 E. Army Creation
An example of multi module collaboration based on NCF
Wechat reading notes of "work, consumerism and the new poor"
BCG 使用之新建向导效果
如何使用Async-Awati异步任务处理代替BackgroundWorker?
Hough transform Hough transform principle
socket编程demo二
Pytest 可视化测试报告之 Allure
kotlin 基本数据类型
Swagger突然发癫
Detailed explanation of the binary processing function threshold() of opencv
Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading
HDU 6440 2018 Chinese college student program design network competition
勾股数规律(任意三个数能够满足勾股定理需要满足的条件)
BCG 使用之CBCGPProgressDlgCtrl进度条使用
【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
Find the nth power of 2