什么是优化模式以获取考勤数据的最佳方法 [英] What is the best way to optimize schema for capturing attendance data

查看:176
本文介绍了什么是优化模式以获取考勤数据的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个体育训练营,经常在城市的各个队伍参加。我们每天的会议时间为2小时(上午9点至11点),不同小组的时段可能会有所不同。我们想要每天捕获谁参加训练营。



我们到达了以下型号以吸引观众。
(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆