当前位置:网站首页>子连接中的参数传递
子连接中的参数传递
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之间字段显示列
简单图片解释如下:

边栏推荐
- 对写作的一些感悟
- Detailed explanation of common DNS resource record types
- 基于深度学习的路面坑洞检测(详细教程)
- 2022 Niu Ke Summer Multi-School Training Camp 5 (BCDFGHK)
- The role of the annotation @ EnableAutoConfiguration and how to use
- 2022牛客暑期多校训练营5(BCDFGHK)
- 【LeetCode】矩阵模拟相关题目汇总
- Three tips for you to successfully get started with 3D modeling
- Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
- d枚举生成位
猜你喜欢

基于Appian低代码平台开发一个SpaceX网站

KT148A voice chip ic working principle and internal architecture description of the chip

看图识字,DELL SC4020 / SCv2000 控制器更换过程

如何写好测试用例

Essential knowledge for entry-level 3D game modelers

~ hand AHB - APB Bridge 】 【 AMBA AHB bus

Getting started with 3D modeling for games, what modeling software can I choose?

407. 接雨水 II

一、爬虫基本概念

golang 协程的实现原理
随机推荐
2022 Niu Ke Summer Multi-School Training Camp 5 (BCDFGHK)
【LeetCode】Summary of Two Pointer Problems
Getting started with 3D modeling for games, what modeling software can I choose?
Vscode连接远程服务器(一套配置成功)
"Relish Podcast" #397 The factory manager is here: How to use technology to empower the law?
入门3D游戏建模师知识必备
工业物联网 —— 新型数据库的召唤
Modelers experience sharing: model study method
The master teaches you the 3D real-time character production process, the game modeling process sharing
SQL association table update
学会反射后,我被录取了(干货)
~ hand AHB - APB Bridge 】 【 AMBA AHB bus
MySQL基础篇【子查询】
Ab3d.PowerToys and Ab3d.DXEngine Crack
Cython
mysql基础
手写分布式配置中心(1)
线程三连鞭之“线程的状态”
KT148A电子语音芯片ic方案适用的场景以及常见产品类型
【云原生--Kubernetes】Pod控制器