我想获得基于不同专业的毕业生的平均工资
3个表涉及: Survey_result(Student_Id,Annual_Salary) Student_Degree(Student_ID,Degree_ID) 度(Degree_ID,Major_Name)
Survey_Result
Student_Degree
需要sql结果:帐号:2000,财务:3000
答案 0 :(得分:0)
我认为你可以这样做:
SELECT
AVG(Survey_Result.Annual_Salary),
Degree.Major_Name
FROM
Degree
JOIN Student_Degree
ON Student_Degree.Degree_ID=Degree.Degree_ID
JOIN Survey_Result
ON Student_Degree.Student_ID=Survey_Result.Student_ID
GROUP BY
Degree.Major_Name