|
|
Question : Database Design
|
|
I'm creating a calendar (for Web with ASP.NET and Visual Basic and SQL Server) with functions to add both one-time meetings and recurring meetings, just like in Microsoft Outlook, and I need some tips for how to design the database.
Should there be one table for one-time meetings and one for recurring ones? Or just one table with a field saying if it's one-time or recurring?
And if the user has added an meeting that occurs every week, they should be able to edit or delete one single event afterwards, while the rest stays as they are. Would that need a table for exceptional events? And what, then, would the main table look like?
I've also got a table containing who comes at which meeting. One must be able to replace a person with another, or delete a person, at a single meeting, even if it's recurring.
|
Answer : Database Design
|
|
I would have a single table for all scheduled events, one-time and recurring. In addition, I would have a subtype table (same PK as the scheduled event table) with a row for each recurring event. The subtype table contains a foreign key to another table that holds the recurrence information.
ScheduledEvent ScheduledEventID INT (PK) Name Varchar EventTime DateTime EventDuration INT
ScheduledRecurringEvent ScheduledEventID INT (PK, FK) RecurringEventID (FK)
RecurringEvent RecurringEventID INT (PK) Name StartDate EndDate RecurrencePattern
Attendee ScheduledEventID (PK,FK) UserID (PK)
|
|
|
|
|