oracle练习题 列出至少有两个雇员的部门名称

oracle练习题 列出至少有两个雇员的部门名称,第1张

既然求各部门总雇员数,应该要分组。你的语句没有分组选项。

各部门的雇员数:

select deptno,count(deptno) from emp group by deptno;

部门雇员大于1:

select deptno,count(deptno) from emp having count()>1 group by deptno;

1

select country,

sum(case when sex=1 then pop else 0 end),

sum(case when sex=2 then pop else 0 end) from demo

group by country

2

select case when country in ('中国') then '亚洲' 

            when country in ('美国','加拿大') then '美洲' 

            when country in ('英国') then '欧洲' end, 

       sum(case when country in ('中国') then pop 

            when country in ('美国','加拿大') then pop

            when country in ('英国') then pop end)

from demo

group by case when country in ('中国') then '亚洲' 

            when country in ('美国','加拿大') then '美洲' 

            when country in ('英国') then '欧洲' end

第一个procedure需要commit的。

第二个一般都是写成function,把最高薪水返回给调用者。如果题目是要求写一个procedure的话,应该把存最高薪水的的变量写成 out ,这样才可以返回一个最高薪水的值给调用者。

1、

select sname,ssex from student where sdept in ('is','ma','cs');

2、

select sname,ssex,sage from student where sdept not in ('is','ma');

3、

select sno from sc where count(coo) >= 3 group by sno;

4、

select student from sc,student where studentson = scsno and sccoo = ' 2' and scgrade >= 90;

5、

select from student order by sdept asc,sage desc;

以上就是关于oracle练习题 列出至少有两个雇员的部门名称全部的内容,包括:oracle练习题 列出至少有两个雇员的部门名称、Oracle 函数中使用case-when题目、oracle 存储过程设计题,高手大侠帮忙啊!!!等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10113782.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存