Is the following query returns the output?
SELECT Subject, AVG (marks)
FROM Students
WHERE AVG(marks) > 70
GROUP BY Subject
Add comment
Answers (1)
Add AnswerNo, this Query will not work. it will throw you an error.
you can not use an aggregate function with a where clause.
if you still want to filter out data whose average makes is greater than 70 then you can use the HAVING clause. as below.
SELECT Subject, AVG (marks) FROM Students GROUP BY Subject HAVING AVG(marks) > 70