I have a really basic question on SQL.
Relational Schema:
- Student (Sid, Sname )
- Class (Sid, ClassName, mark)
- ClassName = { MATH, ENGLISH, PHY, .......}
I want to list out all the student who have taken MATH, and their MATH class average minus the student's math mark
Select DINSTINCT S.Sname, (E.Mark - AVG (E.Mark))
From Student As S, Class As C
Where C.ClassName = 'MATH' AND S.Sid = C.Sid
I don't know how to do difference; I don't think this is right; can someone tell me how to fix this?