当前位置:网站首页>Task04:集合运算-表的加减法和join等--天池龙珠计划SQL训练营学习笔记
Task04:集合运算-表的加减法和join等--天池龙珠计划SQL训练营学习笔记
2022-06-30 18:16:00 【游戏编程】
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
前言
本章节为天池龙珠计划SQL训练营Task04课时的学习笔记,关于SQL集合运算-表的加减法和join等知识的介绍。
一、表的加减法
1. 什么是集合运算
集合在数学领域表示“各种各样的事物的总和”, 在数据库领域表示记录的集合. 具体来说,表、视图和查询的执行结果都是记录的集合, 其中的元素为表或者查询结果中的每一行。
在标准 SQL 中, 分别对检索结果使用 UNION, INTERSECT, EXCEPT 来将检索结果进行并,交和差运算, 像UNION,INTERSECT, EXCEPT这种用来进行集合运算的运算符称为集合运算符。
二、连结(JOIN)
1. 内连结(INNER JOIN)
内连结的语法格式是:
– 内连结
FROM <tb_1> INNER JOIN <tb_2> ON <condition(s)>
2. 外连结(OUTER JOIN)
—内连结会丢弃两张表中不满足 ON 条件的行,和内连结相对的就是外连结. 外连结会根据外连结的种类有选择地保留无法匹配到的行.
按照保留的行位于哪张表,外连结有三种形式: 左连结, 右连结和全外连结.
左连结会保存左表中无法按照 ON 子句匹配到的行, 此时对应右表的行均为缺失值; 右连结则会保存右表中无法按照 ON 子句匹配到的行, 此时对应左表的行均为缺失值; 而全外连结则会同时保存两个表中无法按照 ON子句匹配到的行, 相应的另一张表中的行用缺失值填充.
三种外连结的对应语法分别为:
– 左连结
FROM <tb_1> LEFT OUTER JOIN <tb_2> ON <condition(s)>
– 右连结
FROM <tb_1> RIGHT OUTER JOIN <tb_2> ON <condition(s)>
– 全外连结
FROM <tb_1> FULL OUTER JOIN <tb_2> ON <condition(s)>
总结
以上就是今天要讲的内容,本文仅仅简单介绍了集合运算、表内连接和外连接的定义。
作者:余小小小小鱼
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- Compare the audio librosa library with the Mel spectrogram in the torchaudio library
- 传统微服务框架如何无缝过渡到服务网格 ASM
- 简述机器学习中的特征工程
- 基于UDP协议设计的大文件传输软件
- Unity技术手册-初探性能优化
- Large file transfer software based on UDP protocol
- MySQL transaction concurrency and mvcc mechanism
- Year after year, why is breaking the data island still the primary task of enterprise development
- slice
- 法国A+ 法国VOC标签最高环保级别
猜你喜欢

Kalman filter -- Derivation from Gaussian fusion

Browser window switch activation event visibilitychange

联想YOGA 27 2022,超强配置全面升级

Some interesting modules

Swin-transformer --relative positional Bias

Electron 入门

TCP packet sticking problem

法国A+ 法国VOC标签最高环保级别

Huaxing Securities: kitex practice under the original hybrid Cloud Architecture

France a+ France VOC label highest environmental protection level
随机推荐
MySQL modify data type_ MySQL modify field type [easy to understand]
CODING 正式入驻腾讯会议应用市场!
法国A+ 法国VOC标签最高环保级别
Trust configuring domestic sources
Teach you how to write selenium test cases
Entropy - conditional entropy - joint entropy - mutual information - cross entropy
slice
BeanUtils.copyProperties() 对比 mapstruct
「杂谈」如何改善数据分析工作中的三大被动局面
CTF流量分析常见题型(二)-USB流量
【UML】UML类图
Unity technical manual - preliminary performance optimization
Iris, the web framework of go
20200525-生物技术-四川师范大学自考生物技术(本科)考试计划.txt
NBI visual platform quick start tutorial (V) introduction to editor functions and operations
German agbb VOC hazardous substances test
Ambient light and micro distance detection system based on stm32f1
Compare the audio librosa library with the Mel spectrogram in the torchaudio library
商业智能BI与业务管理决策思维之四:业务成本分析
「经验」爬虫在工作中的实战应用『实现篇』