Students
and Subjects
tables to create all possible combinations of students and subjects.Examinations
table by student_id
and subject_name
and count the occurrences to get the number of attended exams.student_id
and subject_name
as keys.IFNULL
or a similar function to replace null values in the attended_exams
column with zero.student_id
and subject_name
.erDiagram Students { int student_id PK varchar student_name } Subjects { varchar subject_name PK } Examinations { int student_id varchar subject_name }