I'm working on my students attendance system project. I have a list of students along with their ID (jntuno
) and I need to create a database in MySQL for storing the daily attendance of each student for each subject.
Table: students
Fields:
slno int(5) auto increment,
jntuno char(15),
name char(50),
primary key(slno,jntuno).
Data:
This students
table holds the list of students and their IDs.
Now I created another table:
Table: dailyatt
Fields:
date date,
subject char(10),
classesconducted int(2),
`11341A0501` int(2),
`11341A0502` int(2),
`11341A0503` int(2),
.
.
.
`11341A0537` int(2),
primary key(date,subject).
This table will look like:
+------------+-----------+-----------------+------------+-----------+-----------+ |date |subject |classesconducted |11341A0501 |11341A0502 |11341A0503 |.... +------------+-----------+-----------------+------=-----+-----------+-----------+ | | | | | | |
Now every day upon entering the attendance on the PHP website, a new row will be created for each subject taught on that day.
But many said that the database model is not a good one. Can someone suggest a better model for this kind of problem?