0
Select the correct SQL query that returns all students whose results are greater than the average result of their respective departments.
- ASELECT stu_id FROM student WHERE result > (SELECT AVG(result) FROM student GROUP BY dept_id);
- BSELECT stu_id FROM student WHERE result > AVG(result) GROUP BY dept_id;
- CSELECT stu_id FROM student s WHERE result > (SELECT AVG(s.result) FROM student);
- DSELECT stu_id FROM student s WHERE result > (SELECT AVG(result) FROM student WHERE dept_id = s.dept_id);
Correct answer: D