Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Desgin Issue

Author  Topic 

vk59
Starting Member

38 Posts

Posted - 2005-03-07 : 07:14:14
Hi, This is a design Issue.

There are 3 tables namely tbl_State, tbl_Dept & tbl_DeptState(Mapping between tbl_State and tbl_Dept)

In the tbl_state table I will have list of all the States available
In th tbl_Dept table I will have list of all the Depts available

In tbl_DeptState table I have below columns

DeptStateId -->Int -->PK-->Not Null
DeptId -->Int -->FK-->NULL
StateId -->Int -->FK--NULL

At any point of time only DeptId or StateId is null not the both.


My Concern is, Can I store the data in the tbl_DeptState in such a way that if DeptId is null then it applies to all States and Similarly If StateId is null then it applies to all the depts.


Please let me know whether I am violating any normalization rules and whether my approach is right.


Thanks In Advance
Vk59

`

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-03-07 : 10:26:31
Typical design for an association table would be to not allow nulls for the association columns. Unless we're talking millions of records here, I'd probably explicitly load all deptIDs for "all" states and all StateIDs for "all" deptartments. That would make the queries simple and efficient.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -