SQLDeveloper:指定经理的最低工资员工。给出的示例代码
我正在尝试编写一个查询来显示管理器编号。工资最低的员工为经理。我们丢弃低于1k的工资 所以我尝试为其编写代码,但它给了我一个错误。我想我必须编辑第二行中的 FROM 条件:
SELECT empno, sal
FROM emp a, emp b
WHERE empno IN (SELECT boss.empno
FROM emp a, emp boss
WHERE a.super = boss.empno)
AND MIN(sal) >1000;
I am trying to write a query to display manager no. and the lowestwages employee for manager. we discard wages less than 1k
So I tried writing a code for it but its giving me an error. I think I have to edit the FROM condition in the second line:
SELECT empno, sal
FROM emp a, emp b
WHERE empno IN (SELECT boss.empno
FROM emp a, emp boss
WHERE a.super = boss.empno)
AND MIN(sal) >1000;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
基本上在员工表上进行自连接并按经理进行分组并获取员工的最低工资。
还没有测试过,所以可能需要一些调整
Try this:
Basically doing a SELF JOIN on employee table and GROUPing BY manager and getting the MIN salary of employee.
Haven't tested it yet so it may need a bit of tweeking