试图显示薪水高于平均工资的导师姓名

时间:2017-09-04 16:32:40

标签: sql

我尝试做的是

SELECT tName, avg(Tutor.salary) AS avgSalary
FROM Tutor
GROUP BY tName
HAVING Tutor.salary > avgSalary;

1 个答案:

答案 0 :(得分:0)

由于您的问题不完整,我假设您在表tName中有列salaryTutor。你想要做的是提取平均值然后比较:

SELECT tName, salary FROM Tutor
WHERE
salary > (SELECT avg(salary) FROM Tutor);