Oracle(七)比较操作符

Posted on 2021-04-08 00:09  MissRong  阅读(74)  评论(0)    收藏  举报

Oracle(七)比较操作符

select e.empno, e.ename, e.job, e.sal from emp e
where e.sal < any (
select f.sal from emp f where f.job = 'CLERK')
and e.job <> 'CLERK';

select e.ename from emp e where e.empno not in (
select f.mgr from emp f where f.mgr is not null
)

--查询'c001'课程比'c002'成绩高的所有学生的学号

select sno
from sc a, sc b
where a.cno = 'c001'and a.sno=b.sno and b.cno = 'c002' and a.score>b.score);

--查询平均成绩大于60分的同学的学号和平均成绩

select s.sno, avg(s.score)
from sc s
group by s.sno
having avg(s.score)>60;

 

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3