oracle .java 面试题,如下图,怎么写?

2025-03-04 20:33:00110 次浏览

最佳答案

1.1)  select max(e.sal), min(e.sal) from emp e group by e.deptno;

1.2) select max(e.sal), min(e.sal) from emp e  

where  e.job = 'CLERK' group by e.deptno;

1.3) select e.ename, e,deptno, e.sal from emp 

order by e.deptno desc , e.sal asc

2.1) select s.stuid, s.name, sum(s.core) total_score 

from stuscore s group by s.stuid ,s.name order by total_score desc

2.2) select s1.subject, s2.* from stuscore s1 

join (select s.stuid, s.name, max(s.score) max_score 

from stuscore s group by s.stuid, s.name) s2  

on s1.score = s2.max_score  and s1.stuid = s2.stuid

2.3) select avg(s.score) avgscore ,s.stuid,s.name  

from stuscore s group by s.stuid,s.name

2.4)  select *from (SELECT s.name,s.stuid,s.subject,s.score,

row_number() OVER(PARTITION BY s.subject ORDER BY s.score desc) e FROM stuscore s)

 t where e <= 2

声明:知趣百科所有作品均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请在页面底部查找“联系我们”的链接,并通过该渠道与我们取得联系以便进一步处理。