To your specific question of (easily satisfied) plausibility, the answer is yes. Since you seem to be looking for a broader critique. You seem to be mostly on the right track, but a few things are making your description overly complex.
It looks like your Classes table is more like what I would consider a course to be and your departments_teachers_and_classes is more of what I would expect a Classes table to be. A course would be Math, but a class would be the Math course taught by a particular teacher during a particular school term. A class is like an instance of a course.
To carry this change through, your departments_teachers_classes_and_students could simply be ClassStudents.
It seems as though you are using the department concept on several different levels. You should decide where the department belongs and stop referencing it everywhere else. You've said that a teacher can teach for multiple departments, so we can't put the department in the teachers table. This leaves Classes and Courses. Whichever you decide, it need only have a foreign key to the Departments table (unless you decide that one can be in multiple Departments). This eliminates the Departments_and_teachers table.
Teachers_and_Students could be replaced with a teacher foreign key in the Classes table and students/classes foreign keys in a ClassStudents table.
In short, for the portion of the design you have described, you probably need the following tables:
Departments
Teachers
Students
Courses
Classes
ClassStudents
Terms
Creating independent databases will create the risk that as data structures change with the application, structural changes (and any associated data migrations) must be propagated to all of the databases. This can get tricky. A school_id
in the tables that need it will simplify things in the sense that you only need to maintain one database.
Multiple databases would make more sense if you are going to deploy the application to physically separate clients (such as if the application runs independently on a server in the school), but will make maintenance more difficult.
Another place where it might make sense to have a separate database for each client would be if you know there will be slightly different versions of the data structures for each client. Of course, changes to common structures would still have to be propagated to all variant databases, and then you have to ensure that common patches/upgrades to the application work properly with the variants.
In general, I'd try to keep it all in one multi-tenant database, unless there is a very good reason to split it up.
Best Answer
From your comments,
Person
represents the generic information about any person tied to this system; students, teachers, other school employees. Information that's inPerson
wouldn't need to be repeated inStudent
(name, address, DOB).I would add the student's current grade/class (kindergarten through high school) to
Student
. Let's call thatStudentClass
; we'll use it later.Also - you may need an intermediary table to go with
MarkType
andMark
. I would think you'd need something to indicate the total available points for each item (as shown in the headers of your output).MarkType
makes sense as is. I would haveMark
as a table indicating a particular exam, quiz, homework assignment (etc.). So, it would need:MarkID
(primary key)MarkType
SubjectId
MarkValue
- the points this specific item is worth (for example 10 points).Then, I would have
StudentMarks
:StudentMarkId
(primary key)MarkId
StudentId
Mark
- the points earned on this specific item, by this student (for example one student might get 9 points out of the possible 10, other might only get 5).I would also be inclined to decouple
Term
andSubject
- there may be subjects that are only offered for one term. Similarly, different instructors may provide a different mix of assignments, and assign different values to a given assignment than another instructor. I would create two new tables:Instructor
: -InstructorId
(primary key) -PersonID
(foreign key toPerson
, where name, address, DOB would be) - ... (other information specific to a given instructor, regardless of the subject they're teaching, or the term/year they're teaching it in)Course
: -CourseId
(primary key) -SubjectId
-TermId
-InstructorId
TermId
would be removed fromSubject
, andCourseId
would replaceSubjectId
inMark
.Another note: it might make sense to specifically tie a student to a course. that could be called....
CourseRoster
: -StudentCourseId
(primary key) -StudentId
-CourseId
-StudentCurrentClass
(the value ofStudentClass
at the time this student was in this class).In that case, replace
StudentId
withStudentCourseId
inStudentMarks
.This would even let you identify if there were exams/quizzes/assignments that a particular student in a particular course had no mark for.
UPDATE: Based on your comments, I added some fields to track the student's current "class" (K through high school), and their class when they took a specific course. consists of hard-coded values (in the US, there's kindergarten plus 12 years of education before university, so "K" and "1" - "12" would work here), the
Class
table shouldn't actually be needed.If you need to establish explicit classes for some reason, then theClass
table would still be needed. I would reverse it, though - one class has multiple students, so putClassID
in theStudent
table. Note: you may want to consider tying eachClass
to a specificTerm
, as well.