Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design for school attendance system

Tags:

database

mysql

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.

The table structure is

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

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?

like image 265
Checksum Avatar asked Jun 20 '09 13:06

Checksum


People also ask

Which technology is used in attendance management system?

Facial Recognition Facial recognition technology is another biometric factor used in time and attendance tracking systems. Facial recognition involves many of the same processes as fingerprint scanning and storage.

What is database design with example?

Database design is the organization of data according to a database model. The designer determines what data must be stored and how the data elements interrelate. With this information, they can begin to fit the data to the database model. Database management system manages the data accordingly.


3 Answers

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.

like image 88
Michiel Avatar answered Sep 20 '22 23:09

Michiel


A couple of points.

  • 2 million records is not a big table.
  • having a separate table per class is definitely not normalized.

You haven't really provided enough information re links to other table and what else, if anything, this table will store. But you should be starting with 3NF for all tables and only changing that if you find performance problems.

like image 39
paxdiablo Avatar answered Sep 18 '22 23:09

paxdiablo


As long as you indexed your table columns properly, there shouldn't be a big problem with the first table.

I would disagree with the idea of splitting it up into the 12 classes, because you have no guarantee that that is the way it is going to stay (classes added, classes merge, etc.).

Mucking up your database normalization for a perceived benefit of efficiency is something you should look at only for extreme circumstances (if ever)

like image 24
TheTXI Avatar answered Sep 17 '22 23:09

TheTXI