当前位置:网站首页>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;
边栏推荐
猜你喜欢
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
BCG 使用之新建向导效果
YOLOv5s-ShuffleNetV2
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
线上数据库迁移的几种方法
HMM隐马尔可夫模型最详细讲解与代码实现
关于判断点是否位于轮廓内的一点思考
To sort out messy header files, I use include what you use
Introduction to polyfit software
Comment utiliser async awati asynchrone Task Handling au lieu de backgroundworker?
随机推荐
升级智能开关,“零火版”、“单火”接线方式差异有多大?
How to use async Awati asynchronous task processing instead of backgroundworker?
English grammar_ Noun - use
BCG 使用之CBCGPProgressDlgCtrl进度条使用
MySQL数据库基本操作-DDL | 黑马程序员
C# 使用StopWatch测量程序运行时间
页面元素垂直水平居中、实现已知或者未知宽度的垂直水平居中。
Add namespace declaration
An example of multi module collaboration based on NCF
Matrix flip (array simulation)
西门子HMI下载时提示缺少面板映像解决方案
Shell programming core technology "four"
指定输出的字符集
Mysql database basic operation -ddl | dark horse programmer
1007 Maximum Subsequence Sum(25 分)(PAT甲级)
明明的随机数
SSRS筛选器的IN运算(即包含于)用法
Hough transform Hough transform principle
The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
abc229 总结(区间最长连续字符 图的联通分量计数)