1280.sql (301B)
1 SELECT S.student_id, S.student_name, C.subject_name, COUNT(E.student_id) AS attended_exams 2 FROM Students S 3 CROSS JOIN Subjects C 4 LEFT JOIN Examinations E 5 ON S.student_id = E.student_id AND 6 C.subject_name = E.subject_name 7 GROUP BY S.student_id, C.subject_name 8 ORDER BY S.student_id, C.subject_name 9