Here is a detailed Entity-Relationship (ER) Diagram for a Student Attendance Management System:
erDiagram
STUDENT ||--o{ ENROLLMENT : registers_for
COURSE ||--o{ ENROLLMENT : is_taken_by
TEACHER ||--o{ COURSE : teaches
COURSE ||--|{ CLASS_SESSION : schedules
TEACHER ||--o{ CLASS_SESSION : leads
CLASS_SESSION ||--|{ ATTENDANCE_RECORD : records
STUDENT ||--|{ ATTENDANCE_RECORD : has_status
class STUDENT {
int StudentID PK
varchar FirstName
varchar LastName
varchar Email
}
class TEACHER {
int TeacherID PK
varchar FirstName
varchar LastName
varchar Email
}
class COURSE {
int CourseID PK
varchar CourseCode
varchar CourseName
}
class ENROLLMENT {
int EnrollmentID PK
int StudentID FK
int CourseID FK
varchar Semester
}
class CLASS_SESSION {
int SessionID PK
int CourseID FK
int TeacherID FK
datetime SessionDateTime
varchar Location
}
class ATTENDANCE_RECORD {
int RecordID PK
int SessionID FK
int StudentID FK
enum Status "Present, Absent, Late, Excused"
}
Explanation of Entities and Relationships
-
STUDENT
- Represents the individuals whose attendance is being tracked.
- Attributes: StudentID (PK), FirstName, LastName, Email.
-
TEACHER
- Represents the instructors who teach the courses and record attendance.
- Attributes: TeacherID (PK), FirstName, LastName, Email.
-
COURSE
- Represents the subject being taught (e.g., Biology 101).
- Attributes: CourseID (PK), CourseCode, CourseName.
-
ENROLLMENT (Junction Table)
- Resolves the Many-to-Many relationship between Students and Courses.
- Attributes: EnrollmentID (PK), StudentID (FK), CourseID (FK), Semester.
-
CLASS_SESSION
- Represents a specific scheduled class (e.g., The BIO101 lecture on Oct 25th at 10:00 AM).
- Attributes: SessionID (PK), CourseID (FK), TeacherID (FK), SessionDateTime, Location.
-
ATTENDANCE_RECORD
- Links a specific student to a specific class session and records their status.
- Attributes: RecordID (PK), SessionID (FK), StudentID (FK), Status (Present, Absent, Late, Excused).
Relationships
-
STUDENT to ENROLLMENT to COURSE
- A student can enroll in many courses, and a course has many students.
-
TEACHER to COURSE
- One teacher can teach many courses.
-
COURSE to CLASS_SESSION
- One course will have many scheduled sessions.
-
TEACHER to CLASS_SESSION
- A teacher leads many class sessions.
-
CLASS_SESSION to ATTENDANCE_RECORD
- For a single class session, there are many attendance records.
-
STUDENT to ATTENDANCE_RECORD
- A student will have many attendance records over time.
This ER diagram provides a comprehensive structure for managing student attendance, including the relationships between students, teachers, courses, and class sessions.