Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
228 views
in Technique[技术] by (71.8m points)

mysql - How to create a database which needs to be able to store same type of data each day

I'm trying to create a attendence tracking website for students .where attendence of students with respect to each day and each hour of class is stored in a table "classname" so How can I add data into this table each day without deleting previous data..

Consider a class with students name and periods as 1st hr,2nd hr.. etc up to 5hrs per day.. and a date field..

Each day each hr the attendance is marked to this table.. so after a week or a month we could generate a report out of it..

Here comes my question, After taking attendence for one day the table is complete. so how data will be saved and the same table is used for next day.

question from:https://stackoverflow.com/questions/66059006/how-to-create-a-database-which-needs-to-be-able-to-store-same-type-of-data-each

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Let's say we have these columns in the table:

(
ID int primary key identity(1,1), 
fk_studentsID int foreign key(fk_studentsID) references Sudents (ID) not null,
fk_classID int foreign key(fk_classID) references Classes (ID) not null,
Date date not null, 
Hours int CHECK (Hours>=1 AND Hours<=5) not null,
Mark bit not null)

Then you can output the total statistics for the day or the individual student's attendance for a certain time, etc.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...