Subquery in SELECT
sql
1SELECT name, marks,
2 (SELECT AVG(marks) FROM students
3 WHERE course = s.course) AS course_avg
4FROM students s;Shows each student's course average.

1SELECT name, marks,
2 (SELECT AVG(marks) FROM students
3 WHERE course = s.course) AS course_avg
4FROM students s;Shows each student's course average.