Database table design for scheduling tasks
This is the table structure i came up with;
Schedule
- ScheduleName
- ScheduleTypeId (Daily, Weekly, Monthly, Yearly, Specific)
- StartDate
- IntervalInDays
- Frequency
- FrequencyCounter
ScheduleDaily
- ScheduleDailyId
- ScheduleId
- TimeOfDay
- StartDate
- EndDate
ScheduleMonthly
- ScheduleMonthlyId
- ScheduleId
- DayOfMonth
- StartDate
- EndDate
ScheduleSpecific
- ScheduleSpecificId
- ScheduleId
- SpecificDate
- StartDate
...
ScheduleJob
- ScheduleJobId
- ScheduleId
- ScheduleTypeId
- RunDate
- ScheduleStatusId
Microsoft SQL Server has an efficient and flexible design: https://msdn.microsoft.com/en-us/library/ms178644.aspx