Question: A report listing all courses and their total number of attendances which have more than 5 attendances in each course by using aggregate function with GROUP BY and “HAVING” condition
Statement:
SELECT SUM(NO_OF_ATTENDANCES), COURSE_ID, EXERCISE_TYPE, COURSE_LOC
FROM I_COURSE
GROUP BY COURSE_LOC
HAVING SUM(NO_OF_ATTENDANCES) > 5;
Please help me and tell me what is wrong and why the error is obtained.
Table name is I_COURSE
Attributes are: COURSE_ID, EXERCISE_TYPE, COURSE_LOC, NO_OF_ATTENDANCES