Env: mysql
How should I go about modeling the event duration for the following scenarios…
Today is Monday (start of the week)
- One day event scheduled between 10 AM – 5 PM today.
- Every day event open from 10 AM – 11 AM from today till 1 week. (inclusive of weekends)
- Every day event open from 10 AM – 11 AM from today till 2 weeks. (exclusive of weekends)
I would choose the easy way:
EDIT:
In the light of recent comments, a solution that would also support recurrent events and a more fine-grained time interval selection would be:
This table holds all the event information (i.e. name, …).
These are the corresponding time intervals for each of the events. For recurrent events we will set the
isRecurrentfield toTrue.For this data set
this (pretty much contrived) query
lists all the events: