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

边栏推荐
猜你喜欢

First, the basic concept of reptiles

Essential knowledge for entry-level 3D game modelers

矩阵数学原理

Senior game modelers tell newbies, what are the necessary software for game scene modelers?

【手撕AHB-APB Bridge】~ AMBA总线 之 AHB

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

如何写好测试用例

基于深度学习的路面坑洞检测(详细教程)

【SSR服务端渲染+CSR客户端渲染+post请求+get请求+总结】

年薪50W+的测试工程师都在用这个:Jmeter 脚本开发之——扩展函数
随机推荐
"Relish Podcast" #397 The factory manager is here: How to use technology to empower the law?
Uniapp dynamic sliding navigation effect demo (finishing)
大师教你3D实时角色制作流程,游戏建模流程分享
The role of the annotation @ EnableAutoConfiguration and how to use
2022牛客暑期多校训练营5(BCDFGHK)
KT148A语音芯片怎么烧录语音进入芯片里面通过串口和电脑端的工具
入门3D游戏建模师知识必备
OPENCV学习DAY8
@Async注解的作用以及如何实现异步监听机制
图解 Canvas 入门
Day118. Shangyitong: order list, details, payment
.net (C#) get year month day between two dates
LeetCode Hot 100
jenkins send mail system configuration
Cloud native - Kubernetes 】 【 scheduling constraints
Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
加解密在线工具和进制转化在线工具
【LeetCode】矩阵模拟相关题目汇总
MYS-6ULX-IOT 开发板测评——使用 Yocto 添加软件包
中日颜色风格