什么是优化模式以获取考勤数据的最佳方法 [英] What is the best way to optimize schema for capturing attendance data
问题描述
我们到达了以下型号以吸引观众。
(id,user_id,date,present)。假设用户每天(例如每月30天)参加营地,您将在数据库中看到许多记录。
假设我们只想找出数字用户参加营地的日子有没有更好的方法来标记特定用户的存在或不存在(可能只有一行一个月,并将所有的个别日子标记为像P(P,P,P,A ,...,A,P)P =存在,A =缺席
AttMst
id | date
AttDet
attdetid | id | userid
以这种方式,您需要在AttMst中存储一天,当天的当前用户将被存储在AttDet中。
We have a sports training camp which is regularly attended by various teams in the city. We have a session per day spanning 2 hrs(9-11 AM) and the time slots could vary for different teams. We would like to capture who attended the training camp on a daily basis.
We arrived at the following model to capture attendance. (id, user_id, date, present). Assuming the user attends camp daily (say 30 days in a month), you will see that many records in the database.
Assuming we are interested only in finding out the number of days the user has attended the camp, is there a better way to mark presence or absence of a particular user (maybe just have a single row for a month and mark all the individual days as something like (P,P,P,A, ...,A,P). P = Present, A = Absent
AttMst
id | date
AttDet
attdetid | id | userid
In this way you need to store day in AttMst and the present users on that day will be stored in AttDet.
这篇关于什么是优化模式以获取考勤数据的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!