没有合适的资源?快使用搜索试试~ 我知道了~
Oracle子查询实例代码演示 详细而具体
资源推荐
资源详情
资源评论
谁的工资最低,列出员工名字和工资
select ename,min(salary)
from emp_hiloo
//错误
select max(ename),min(salary)
from emp_hiloo
//错误
select ename,salary
from
where salary=min(salary)
//错误
select ename,salary
from
having salary=min(salary)
//错误
select min(salary)
from emp_hiloo
select ename,salary
from emp_hiloo
where salary=(select min(salary) from emp_hiloo)
子查询--非关联子查询
子查询中的表和主查询中的表之间没有建立关联,主查询的表中的字段和子查询的表中的字段没有写成条件表达式
先执行子查询,结果可以0到多个;当子查询的结果有多个时,把去重后的结果传递给子查询
哪个部门的平均工资比32部门的平均工资高?
//下面这个方法对吗?
select deptno,avg(salary)
from
where avg(salary)>(select avg(salary) from emp_hilo where deptno=32)
//下面这个方法正确
select deptno,round(avg(salary)) avgsal
from
group by deptno
having round(avg(salary))>(select round(avg(salary)) from emp_hilo where deptno=32)
谁跟张无际的职位一样
select ename,job
from
where job=(select job from emp_hiloo where ename='zhangwuji');
=后不能跟两个及以上值
单值运算符
多值运算符
子查询的返回结果是多个时,要用多值运算符in any all
where job=any(select job from emp_hiloo where ename='zhangwuji');
where job in (select job from emp_hiloo where ename='zhangwuji');
where job in (select job from emp_hiloo where ename='zhangwuji')and ename<>'zhangwuji';
剩余8页未读,继续阅读
资源评论
xiegq112
- 粉丝: 0
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 正点原子开拓者FPGA多人表决器代码项目
- EOP-Last5Years.txt
- windows 32位、64位系统常见缺少的库
- 毕业设计基于springboot+vue实现的求职招聘类型网站源码+数据库(高分项目).zip
- 535springboot + vue 体质测试数据分析及可视化设计.zip(可运行源码+数据库文件+文档)
- python毕业设计-基于Django+OpenCV的二维码生成与识别系统源码.zip
- 基于springboot+vue实现的求职招聘类型网站源代码+数据库(优质毕设项目).zip
- iOS APP提审checklist
- 第十四届中北大学ACM程序设计竞赛.zip
- UIGF_200852355_202404242026.json
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功