Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


database design help please


database design help please

Author
Message
gf-350872
gf-350872
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 11
Hi I am having some trouble on how to normalize some tricky tables.

Basically it is a recurrence event table that can either be daily, weekly, monthly or yearly.

I have made it so each recurrence row in the header table can have one id for either daily, weekly, monthly or yearly. This id corresponds to the appropriate table. Each table has different structures.

So here is an example of what I have.

Table: Recurrence
Columns: RecurrenceId (PK), RecurrenceDailyId(FK), RecurrenceWeeklyId (FK),
RecurrenceMonthlyId (FK), RecurrenceYearlyId (FK)

Table: RecurrenceDailyId
Columns: RecurrenceDailyId(PK), EveryDays, DayOfWeek etc

Table: RecurrenceWeeklyId
Columns: RecurrenceWeeklyId(PK), EveryWeeks, TimesAWeek etc

etc

What is the best way to create this structure so it is normalized? am I on the right path?
Grant Fritchey
Grant Fritchey
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17561 Visits: 32253
Nah, I'd say you're digging a bit of a hole. Instead how about something like

Recurrence ... whatever columns are unique to the recurrence
RecurrenceSchedule ... just a listing of each of the types, daily, monthly, etc., and any unique values to them
RecurrenceScheduleType ... a join between the schedule and the recurrance. Probably make the primary key the two tables keys, but put a unique constraint on the Recurrence key in addition so that a recurrence can only have one type.

The other method involves a lot of null values and joins to tables without data. This will ensure you always get data back.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
gf-350872
gf-350872
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 11
Thanks
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search