当前位置:网站首页>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;
边栏推荐
- Find the nth power of 2
- Reflection (I)
- Shell programming core technology "three"
- Shell programming core technology "four"
- 牛客小白月赛7 I 新建 Microsoft Office Word 文档
- MySQL数据库基本操作-DDL | 黑马程序员
- Shell 编程核心技术《四》
- 26. Delete the duplicate item C solution in the ordered array
- Oracle with as ora-00903: invalid table name multi report error
- kotlin 条件控制
猜你喜欢

HMM隐马尔可夫模型最详细讲解与代码实现

JVM系列之对象的创建

FPGA时序约束分享01_四大步骤简述

黑马程序员-软件测试--09阶段2-linux和数据库-31-43修改文件权限字母发的说明,-查找链接修改文件,查找文件命令,链接文件,压缩解压方式,vi编辑器基本使用,
牛客小白月赛7 谁是神箭手

Oracle with as ORA-00903: invalid table name 多表报错

mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总

OpenCV的二值化处理函数threshold()详解

联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点

【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
随机推荐
FPGA timing constraint sharing 01_ Brief description of the four steps
Hough transform Hough transform principle
Introduction to polyfit software
Lm10 cosine wave homeopathic grid strategy
Is it safe to open an account at Great Wall Securities? How to open an account when buying stocks
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
1003 emergency (25 points) (PAT class a)
Educational Codeforces Round 22 E. Army Creation
Shell 编程核心技术《二》
LM10丨余弦波动顺势网格策略
Online sql to excel (xls/xlsx) tool
联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点
@transactional滥用导致数据源连接池耗尽问题
关于判断点是否位于轮廓内的一点思考
Allure of pytest visual test report
The difference and usage between substr (), slice (), and substring () in the string interception methods of "understand series after reading"
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
SSRS筛选器的IN运算(即包含于)用法
双冒号作用运算符以及命名空间详解
Euler function

