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)
 Lookups

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-15 : 09:12:41
Badreldin writes "I have 3 lookup tables:

Departments (DeptID,deptName)
Sections (secID,SecName)
Devisions (DivID,DIvName)
the departments contains sections
and sections contains devisions

i make relations between this tables using 2 ways:

(1)
Departments (DeptID,DeptName)
DeptID As PK(Primary key)

Sections (DeptID,SecID,SecName)
DeptID,SecID as PK
DeptID as foriegn key(FK)

Devisions (DeptID,SecID,DivID,DivName)
DeptID,SecID,DivID as PK
DeptID,SecID as FK

(2)

Departments (DeptID,DeptName)
DeptID As PK(Primary key)

Sections (DeptID,SecID,SecName)
SecID as PK
DeptID as foriegn key(FK)

Devisions (SecID,DivID,DivName)
DivID as PK
SecID as FK

1- which of these are better for performance wise and normalization wise?

2- is there any link which i can refer for this?

tahnks
Badr "

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-08-15 : 14:56:01
Is there a better way? I think so....

For lookup tables, I generally use a natural key rather than a surrogate key. That way, when I need to query a table, I don't need to join to the lookup table, but I still retain the benefits of referential integrity. If the lookup values never change, then use a check constraint rather than a lookup table.

But don't take my word for it. Try a couple different things and take some performance metrics to see what works best in your environment!

Jay White
{0}
Go to Top of Page
   

- Advertisement -