Here's a few cases to spoil both designs: Teachers get sick. Unions go on strike. Servers go down. Snow days happen.
Class happens when it happens regardless of what the syllabus says. So rather than pretend we know what the future holds, simply record events as they happen.
Events:
absences = class days - attendances
Advantage: design does not require use of confusing misleading non-descriptive nulls.
manpreet
Best Answer
2 years ago
I'm storing data which logs whether or not a user has logged their attendance for a given day. Some days are unimportant (holiday, weekend), so those are also stored.
The two requirements are that:
Right now it seems like I'm faced with two options for how the data should be stored, each with their own advantages/disadvantages:
Option 1: Two Tables
Table
calendar
- Tracks days to be not countedTable
logs
- Tracks successful attendance logsAdvantages:
Challenges:
Option 2: One Table (What I've tried)
Table
calendar
- Tracks logs and days to be counted and not countedAdvantages:
Challenges:
log
==NULL
), making traversal slower than Option 1.My question is this: Is there a way to either use Option 1 and somehow encode the number of missed logs, or is there some other way of storing the data that meets both requirements? I've tried using Option 2, although scaling has become quite a challenge. Thanks in advance for any advice.