Exercise: Stats View
Create view with course statistics.
Solution
sql
1CREATE VIEW course_stats AS
2SELECT course,
3 COUNT(*) AS total,
4 AVG(marks) AS average,
5 MAX(marks) AS highest
6FROM students
7GROUP BY course;
Create view with course statistics.
1CREATE VIEW course_stats AS
2SELECT course,
3 COUNT(*) AS total,
4 AVG(marks) AS average,
5 MAX(marks) AS highest
6FROM students
7GROUP BY course;