当前位置:网站首页>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;
边栏推荐
猜你喜欢

如何使用Async-Awati异步任务处理代替BackgroundWorker?

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

English语法_名词 - 使用

在线SQL转Excel(xls/xlsx)工具

Opencv functions and methods related to binary threshold processing are summarized for comparison and use

There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks

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

TCP两次挥手,你见过吗?那四次握手呢?

92.(cesium篇)cesium楼栋分层
牛客小白月赛7 谁是神箭手
随机推荐
node_ Exporter deployment
1007 maximum subsequence sum (25 points) (PAT class a)
Detailed explanation of the binary processing function threshold() of opencv
PolyFit软件介绍
Functional interface
876. Intermediate node of linked list
kotlin 基本使用
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
Socket programming demo II
Oracle with as ORA-00903: invalid table name 多表报错
Unity editor extends C to traverse all pictures in folders and subdirectories
kotlin 类和对象
Find the nth power of 2
socket编程demo二
How test engineers "attack the city" (Part I)
HDU 6440 2018中国大学生程序设计网络选拔赛
HDU 1097 A hard puzzle
BCG 使用之CBCGPProgressDlgCtrl進度條使用
TCP两次挥手,你见过吗?那四次握手呢?
Shell 编程核心技术《三》

