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

边栏推荐
- 【七夕快乐篇】Nacos是如何实现服务注册功能的?
- The master teaches you the 3D real-time character production process, the game modeling process sharing
- "Relish Podcast" #397 The factory manager is here: How to use technology to empower the law?
- 情人节---快来学习一下程序员的专属浪漫吧
- SQL association table update
- Go 语言快速入门指南:什么是 TSL 安全传输层
- LeetCode Hot 100
- 【七夕情人节特效】-- canvas实现满屏爱心
- The market value of 360 has evaporated by 390 billion in four years. Can government and enterprise security save lives?
- node中package解析、npm 命令行npm详解,node中的common模块化,npm、nrm两种方式查看源和切换镜像
猜你喜欢

基于深度学习的路面坑洞检测(详细教程)
![[LeetCode] Summary of Matrix Simulation Related Topics](/img/80/bd71ca5211cce5805909015a642893.jpg)
[LeetCode] Summary of Matrix Simulation Related Topics

MySQL基础篇【子查询】

Go 语言快速入门指南:什么是 TSL 安全传输层
![情侣牵手[贪心 & 抽象]](/img/7d/1cafc000dc58f1c5e2e92150be7953.png)
情侣牵手[贪心 & 抽象]
![[CVA Valuation Training Camp] Financial Modeling Guide - Lecture 1](/img/8b/360df9a9094037dc358cb21c60cdc8.png)
[CVA Valuation Training Camp] Financial Modeling Guide - Lecture 1

【LeetCode】Summary of Two Pointer Problems

Vscode连接远程服务器(一套配置成功)

Implementing class target method exception using proxy object execution

【无标题】线程三连鞭之“线程池”
随机推荐
怎么将自己新文章自动推送给自己的粉丝(巨简单,学不会来打我)
OpenCV:10特征检测
Vscode连接远程服务器(一套配置成功)
Modelers experience sharing: model study method
3年,从3K涨薪到20k?真是麻雀啄了牛屁股 — 雀食牛逼呀
Getting started with 3D modeling for games, what modeling software can I choose?
4 - "PyTorch Deep Learning Practice" - Backpropagation
入门3D游戏建模师知识必备
The applicable scenarios and common product types of the KT148A electronic voice chip ic solution
从单体架构迁移到 CQRS 后,我觉得 DDD 并不可怕
Couple Holding Hands [Greedy & Abstract]
10 个关于 Promise 和 setTimeout 知识的面试题,通过图解一次说透彻
First, the basic concept of reptiles
MongoDB权限验证开启与mongoose数据库配置
【无标题】
注解@EnableAutoConfiguration的作用以及如何使用
SQL association table update
Implementing class target method exception using proxy object execution
动态上传jar包热部署
2022 Niu Ke Summer Multi-School Training Camp 5 (BCDFGHK)