SreBalaji Thirumalai
SreBalaji Thirumalai

Reputation: 223

Need help in creating a student database

I'm creating a project/web portal for the college database where I have to store students attendance percentage and their grades in various subjects. Currently, I have designed the database as follows. I need to know whether it is a good method of storing data.

Master Table:

Id | roll_number | Department | Year_of_study

Table for adding attendance percentage for each student:

Id | roll_number(foreign key) | Attendance_for_period1 | Attendance_for_period2 

Table for adding subjects:

Id | Subject_name

1   | computer Programming

2   | Data structures

3   | professional ethics

.   
. 
.

Table for adding grades for each student in various subjects:

Id | roll_number(foreign key) | Marks_in_period1 | Marks_in_period2 
1  | 412811104092             | A,B,A,B,C,D      | B,C,A,A,D,F

In Marks_in_period1 column, comma separates grades for each subject (i.e) I have inserted marks for 6 subjects. Is the database correct or need any optimisation?

Upvotes: 0

Views: 292

Answers (1)

Anonymous
Anonymous

Reputation: 12090

You should (almost) never store multiple pieces of data in a single field. Not only does it make it very hard to search inside, you also have to parse the data every time you read/serialize every time you write.

Take a look at this answer.

Upvotes: 1

Related Questions