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)
 Table design question

Author  Topic 

nic
Posting Yak Master

209 Posts

Posted - 2001-09-10 : 20:17:52
Hi I'm having trouble building a solid table structure and I'd like to bounce my plan off of a few people before continuing. Here is the background. I'm building a web application that involves three distinct types of users (all that need to logon.) They are "employees", "customers" and "companies". I need to store totally different data for each group. The "customer" data is historical so I can't modify the keys etc (They are numerical but not necessarly in any order). My plan is to have three tables for the different groups all having numeric primary keys. I will then have a "user main" user table storing: username, password, foreign key of one of the three tables, and a user type (value 1-3 for the different types of users) So something like this:

tblEmployee
empl_key
empl_data

tblCustomer
cust_key
cust_data

tblCompany
comp_key
comp_data

tblUserMain
key
type
username
password

This way I only have to read from the one "main" table when the user logons. Once the person supplies a username and password, I can read the "key" and "type" columns to get the rest of the data.

I originally was going to use the "main" table's primary key as the primary key for the other three tables, but since I'm dealing with historical data, I can't follow that route. Is this a good enough alternative?

Thanks

Nic
   

- Advertisement -