我有两个表,雇主和职位:
雇主
eID
eName
职位
eID
工资
我需要在两个表之间匹配我的 eID,确定最高工资是多少,然后只打印 eName。关于我如何做到这一点的任何建议?我尝试了多种方法,但似乎没有任何效果。
我不确定在哪里放置 max(salary) 函数:
select eName
from employer, position
where employer.eID = position.eID
Run Code Online (Sandbox Code Playgroud) 我有两张桌子,我需要确定能为所有职位提供最高平均工资的公司.我的表格如下:
employer
eID (primary key), eName, location
position
eID (primary key), pName (primary key), salary)
Run Code Online (Sandbox Code Playgroud)
我写的代码确定所有高于1的平均工资,但我需要找到最高的平均工资
到目前为止,这是我的代码:
SQL> select eName
2 from Employer E inner join position P on E.eID = P.eID
3 where salary > (select avg(salary) from position);
Run Code Online (Sandbox Code Playgroud)
这会输出高于最低平均值的所有工资,但我只需要最高的平均值.我尝试使用avg(薪水)>(从位置选择avg(薪水))但我收到了不允许组功能的错误.
任何帮助或建议将不胜感激!