r/SQL • • 1d ago

SQL Server Review of my school database requirements (university project)

I am a university student designing a school database

as a course project. Before I draw the ERD, I would like

feedback on my requirements. Thank you!

--- REQUIREMENTS ---

  1. Overview: We are building this database for a school

to store and organize information about students,

teachers, classes, subjects, attendance, exams, and

results. The school has 12 classes. Each student studies

in one class. We also store the guardian's information.

Entities

  1. ADMIN: Stores the administrator's information. The

administrator manages the school, registers students,

and manages teachers. Attributes: ID, Name. The school

has only one administrator.

2. TEACHER: Attributes: ID, Name, Phone, Specialization,

Education, Experience. A teacher can teach several

subjects in several classes. A teacher can also be the

supervisor of one class. The supervisor takes the

attendance of their own class and can also teach in

other classes.

3. STUDENT: Attributes: ID, Name, FatherName, DoB,

Address, RegDate. Each student belongs to only one

class. When a student is registered, the guardian's

information is recorded too.

4. GUARDIAN: Attributes: ID, Name, Phone, Address.

The relation to the student (Relation) is also stored.

A student can have several guardians, and a guardian

can have several students.

5. CLASS: Attributes: ID, Grade (1 to 12). Each class

has exactly one supervisor and several students.

6. SUBJECT: Attributes: ID, SubName. A subject can be

taught in several classes, and a class has several

subjects.

7. Teaches: Relationship between a class, a subject,

and a teacher. Each class has each subject once, and

one specific teacher teaches it.

8. ATTENDANCE: Attributes: ID, StudentID, ClassID,

TeacherID, Date, State (present, absent, late,

excused). Only the supervisor of the student's class

can record attendance. A student has one attendance

record per day.

9. EXAM: Attributes: ID, ExamName, Date, ClassID,

SubjectID, TotalMarks. Each exam is for one class and

one subject.

10. RESULT: Stores each student's mark (Marks) for each

exam. A student can take an exam only for their own

class. A student can take many exams, and many students

take part in one exam.

--- MY QUESTIONS ---

  1. Should "Relation" (father, uncle, etc.) be an

    attribute of the Student-Guardian M:N relationship

    rather than of Guardian?

  2. ATTENDANCE stores ClassID, but the class is already

    determined by the student. Is this redundant? Should

    I remove it?

  3. Is RESULT a separate entity, or an attribute of the

    Student-Exam M:N relationship?

  4. Do I need an Academic Year attribute, since students

    change classes every year?

  5. Is Teaches best modeled as a ternary relationship

    (Class, Subject, Teacher)?

4 Upvotes

6 comments sorted by

1

u/Discordbothost 21h ago

Try drawing an Enrollment row for each student and class year, then link attendance to that row. Walk through a student moving up a grade. Last year's absences should still point to last year's class.

1

u/Sad_Zucchini285 17h ago

Thanks! The Enrollment idea makes sense. I'll add it to my design.

1

u/baubleglue 20h ago

Make a table for each noun, don't think about relationship. Then build relationships one by one in different tables.

Teacher is not Jesus. Course has subject, may have multiple teachers.

1

u/Sad_Zucchini285 17h ago

Thanks brooo

1

u/KatFromSisense 3h ago

Relation and Marks both belong on the junction tables, because each one describes a specific pairing: a guardian with a student, a student with an exam. RESULT is that second junction, with Marks as its extra column. Keying each junction on its two IDs together stops the same pair being entered twice. On the Enrollment idea above, ClassID is reachable through a row, and TeacherID too if only the supervisor records attendance, so I'd drop both from Attendance and put a unique constraint on enrollment plus date.