- Feb 13, 2003
- 26,256
- 406
- 126
I need to create the tables for a web application and have a question about the best way to design the schema for the application's needs. I am using ASP.NET 3.5 and SQL Server 2005.
The relationship between the objects is fairly simple:
- There's a Location that has a time period, which I interpret as a beginning date and an ending date (spanning days, or perhaps a month or two and days).
- At each Location, there are Personnel. These Personnel can be active for each day in the time period, basically a binary yes/no toggle for each day (i.e. did they work that day).
I have a tblLocation that holds the Location's various info, and a tblPersonnel that holds each person's information. tblLocation has StartDate (datetime) and EndDate (datetime) columns.
So what I need to do next is model the relationship between a Location's time period and the Personnel for each day in that time period. So I was thinking of creating tblLocationPersonnel that had the primary keys of tblLocation and tblPersonnel, as well as a column Active (varchar) that contained the days the Personnel was "active" on that Location. I was just going to store the day numbers separated by commas but I realize now that I'll realistically need the year and month as well.
Another way would be to have the two primary keys and for the Active column, list a single date. So if a Personnel was active for 10 days on a Location, there would be ten records in that table for that relationship. There's going to be probably hundreds or thousands of Personnel, and possible the same number of Locations, so the record count in that table could get quite huge; does this way become inefficient then?
I should note complete normalization is not a requirement here. Any ideas on modelling this relationship? Thanks for any input you can share.
The relationship between the objects is fairly simple:
- There's a Location that has a time period, which I interpret as a beginning date and an ending date (spanning days, or perhaps a month or two and days).
- At each Location, there are Personnel. These Personnel can be active for each day in the time period, basically a binary yes/no toggle for each day (i.e. did they work that day).
I have a tblLocation that holds the Location's various info, and a tblPersonnel that holds each person's information. tblLocation has StartDate (datetime) and EndDate (datetime) columns.
So what I need to do next is model the relationship between a Location's time period and the Personnel for each day in that time period. So I was thinking of creating tblLocationPersonnel that had the primary keys of tblLocation and tblPersonnel, as well as a column Active (varchar) that contained the days the Personnel was "active" on that Location. I was just going to store the day numbers separated by commas but I realize now that I'll realistically need the year and month as well.
Another way would be to have the two primary keys and for the Active column, list a single date. So if a Personnel was active for 10 days on a Location, there would be ten records in that table for that relationship. There's going to be probably hundreds or thousands of Personnel, and possible the same number of Locations, so the record count in that table could get quite huge; does this way become inefficient then?
I should note complete normalization is not a requirement here. Any ideas on modelling this relationship? Thanks for any input you can share.
