当前位置:网站首页>SQL关系代数——除法
SQL关系代数——除法
2022-07-26 22:42:00 【lzl_0408】
如何理解关系中的除法
定义:设关系 R除以关系S的结果为关系T,则T包含所有在R中但不在S中的属性及其值,且T的元组与S的元组的所有组合都在R 中

设有关系R,S以及RS,如图所示,求RS÷S的结果

很容易求得结果为:{张三 }
所以你很容易看出来RS÷S 在这里解决的问题就是:“得到选修了所有课程的学生”
RS÷S的意义就是:“在R和S的联系RS中,找出与S中所有的元组有关系的R元组”。
R(X,Y)÷S(Y,Z)的运算用结构化语言SQL 语句可表达为下列形式:
select distinct R.X from R as R1
where not exists
(
select S.Y from S
where not exists
(
select* from R as R2
where R2.X = R1.X and R2.Y = S.Y
)
);
边栏推荐
- Rabbit learning notes
- DataNode Decommision
- 李宏毅机器学习(2017版)_P1-2:机器学习介绍
- adb. Exe stopped working popup problem
- Flink 1.15 local cluster deployment standalone mode (independent cluster mode)
- New experience of mlvb cloud live broadcast: millisecond low latency live broadcast solution (with live broadcast performance comparison)
- 非递归前中后序遍历二叉树
- Flink1.11 SQL local run demo & local webui visual solution
- Flink sliding window understanding & introduction to specific business scenarios
- Flink1.11 intervaljoin watermark generation, state cleaning mechanism source code understanding & demo analysis
猜你喜欢

Redis -- cache avalanche, cache penetration, cache breakdown

Zhimi Tencent cloud live mlvb plug-in optimization tutorial: six steps to improve streaming speed + reduce live delay

MLVB 云直播新体验:毫秒级低延迟直播解决方案(附直播性能对比)

Flink sliding window understanding & introduction to specific business scenarios

腾讯升级视频号小程序直播功能,腾讯持续推广直播的底气是这项叫视立方(MLVB)的技术

New experience of mlvb cloud live broadcast: millisecond low latency live broadcast solution (with live broadcast performance comparison)

Uni-app 小程序 App 的广告变现之路:Banner 信息流广告

Flinksql multi table (three table) join/interval join

Scala-模式匹配

最长公共子串
随机推荐
One of the Flink requirements - processfunction (requirement: alarm if the temperature rises continuously within 30 seconds)
(Spark调优~)算子的合理选择
What is kubernetes?
Flink的容错机制(checkpoint)
Dataframe of sparksql
Spark data skew solution
FaceNet
李宏毅机器学习(2021版)_P7-9:训练技巧
ADB shell screen capture command
堆排序相关知识总结
MYSQL数据库事务的隔离级别(详解)
Compile Darknet under vscode2015 to generate darknet Ext error msb3721: XXX has exited with a return code of 1.
Flink1.11 intervaljoin watermark generation, state cleaning mechanism source code understanding & demo analysis
Canal introduction
Scala pattern matching
Flink based real-time project: user behavior analysis (I: real-time popular product statistics)
深度学习报告(3)
吴恩达深度学习系列教学视频学习笔记(一)——用于二分类的logistic回归函数
Uni-app 小程序 App 的广告变现之路:Banner 信息流广告
Android——LitePal数据库框架的基本用法