Anjan Baradwaj
Anjan Baradwaj

Reputation: 1229

Trying to map Student with Marks obtained

I have the following tables:

Student(Student_ID(PK), FName, LName,...)
Subject_details(Subject_code(PK), Subject_Name)
Subjects_Enrolled(Student_ID,Subject_Code)

My question is: Can i have table as the one below

Marks_Details(Student_ID,Subject_Code,Marks_Obtained)

Does that table break any rule of database or anything as such? My requirement is to have a table that maps the marks obtained by a student in a particular subject and this is what I've come up with. Is it correct or is there any other approach to do the same? Please let me the know the reason if you're going to downvote. Thanks.

Upvotes: 1

Views: 419

Answers (2)

Kevin Bowersox
Kevin Bowersox

Reputation: 94429

That data model looks fine. Your simply setting up a Many To Many relationship with some additional information (marks) contained in each record.

One suggestion would be to rename the Subject_Details table to Subject. I think this verbiage makes the relationship more clear.

Another suggestion would be to rename Subjects_Enrolled to Enrollment and just add the Marks_Obtained column to this table. This would eliminate the need for Marks_Details since the two tables basically contain the same information. Why store and maintain this data twice? The idea would be to insert a record into Enrollment when a student enrolls within a course and then to update the Marks_Obtained column at a later date when the course is completed.

Upvotes: 2

Johanneke
Johanneke

Reputation: 5763

Your idea doesn't "break any rule of database". I'd actually say it's pretty much the standard way of storing this data.

I would recommend to give the Marks_Details table a separate primary key, and maybe a date field. If a student wants to retake the subject, do you want the new data to override the old, or do you want to keep it both? It's up to you really.

Upvotes: 2

Related Questions