当前位置:网站首页>子连接中的参数传递
子连接中的参数传递
2022-08-04 23:50:00 【赟文武】
列出薪水高于所有所在部门平均工资的员工信息
select deptno,ename,sal from emp a where sal>(select avg(sal) from emp where deptno=a.deptno);
我们先把子句中的where子句去掉,该语句变成如下格式:
select deptno,ename,sal from emp a where sal>(select avg(sal) from emp);
该语句很好理解即求薪水高于所有员工的平均工资的员工信息,执行效果如下:
执行顺序可做如下理解:
- 首先确定表对象emp
- 根据where后条件进行筛选,先执行()内的将()内的看作一个值比较
- 根据select…from中间的东西显示列
在其中加入where语句与外部deptno进行了一个数据限制
select deptno,ename,sal from emp a where sal>(select avg(sal) from emp where deptno=a.deptno);
执行顺序如下:
- 首先执行from确定表对象,
- 根据where条件对数据进行逐行筛选(从外部向内部传入了一个数据)
- 根据select…from之间字段显示列
简单图片解释如下:

边栏推荐
- LeetCode Hot 100
- Security software Avast and Symantec NortonLifeLock merge with UK approval, market value soars 43%
- [LeetCode] Summary of Matrix Simulation Related Topics
- 对“为什么一些程序员很傲慢”的解读
- [Happy Qixi Festival] How does Nacos realize the service registration function?
- uniapp sharing function - share to friends group chat circle of friends effect (sorting)
- 中日颜色风格
- .net(C#)获取两个日期间隔的年月日
- Essential knowledge for entry-level 3D game modelers
- 吐槽 | 参加IT培训的正确姿势
猜你喜欢

Implementing class target method exception using proxy object execution

【七夕情人节特效】-- canvas实现满屏爱心

Pytorch分布式训练/多卡/多GPU训练DDP的torch.distributed.launch和torchrun

407. 接雨水 II

线程三连鞭之“线程的状态”

资深游戏建模师告知新手,游戏场景建模师必备软件有哪些?

~ hand AHB - APB Bridge 】 【 AMBA AHB bus

How to automatically push my new articles to my fans (very simple, can't learn to hit me)

深度|医疗行业勒索病毒防治解决方案

365天深度学习训练营-学习线路
随机推荐
Ab3d.PowerToys and Ab3d.DXEngine Crack
Modelers experience sharing: model study method
KT148A voice chip ic working principle and internal architecture description of the chip
Day118.尚医通:订单列表、详情、支付
SQL关联表更新
中日颜色风格
统计单词(DAY 101)华中科技大学考研机试题
没有这些「伪需求」,产品经理的 KPI 怎么完成?
手写分布式配置中心(1)
What is next-generation modeling (with learning materials)
测试技术:关于上下文驱动测试的总结
d枚举生成位
Cython
矩阵数学原理
【LeetCode】滑动窗口题解汇总
[CVA Valuation Training Camp] Financial Modeling Guide - Lecture 1
3年,从3K涨薪到20k?真是麻雀啄了牛屁股 — 雀食牛逼呀
VMware NSX 4.0 -- 网络安全虚拟化平台
小黑leetcode之旅:95. 至少有 K 个重复字符的最长子串
使用OpenCV实现一个文档自动扫描仪