学校出勤系统的数据库设计 [英] Database design for school attendance system

查看:60
本文介绍了学校出勤系统的数据库设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个学校的项目工作,其中一个特定的模块处理考勤系统.我正在使用LAMP(PHP 5.2+ MYSQL 5+)堆栈进行开发.现在,学校人数约为1500,每年的工作日总数约为250.此外,在删除之前,我必须保留5年的记录.

I'm working on a project for a school where a particular module deals with attendance system. I'm using LAMP(PHP 5.2+ MYSQL 5+) stack for development. Now the school strength is around 1500 and total number of working days per year is around 250. Plus, I've to keep records for 5 years before it can be erased.

表结构为

studentId varchar(12) 
date date
fn varchar(1) *forenoon*
af varchar(1) *afternoon*

如果仅使用一个表,则表示5年内有1,875,000条记录.现在,我考虑不是为每个类(而不是部分)创建一个表,而不是一个庞大的数据库.因此,考虑到有12个类,我将有12个表,这意味着每个表平均有1,55,000条记录是可管理的.

If I simply use a single table, that means 1,875,000 records for a 5 year period. Now instead of such a humongous database, I considered making a table for each class (not section). So considering there are 12 classes, I'll have 12 tables, which means an average of 1,55,000 records per table which is manageable.

这是正确的方法吗?还是有更好的方法?

Is this the right way to do it? Or are there any better ways?

推荐答案

您正在做的事情称为过早优化.这是一个常见的错误.

What you are doing is called premature optimization. This is a common mistake.

最好使数据库结构接近实际,将来,如果需要优化或提高速度,您总是可以做到的.

You are better of getting your database structure as close to reality and in future if there becomes a need for optimization or speed improvement you can always do that.

根据经验并查看您的示例,单表解决方案看起来不错.

From experience and looking at your example the single table solution looks fine.

这篇关于学校出勤系统的数据库设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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