all groups > sql server programming > december 2005 >
You're in the

sql server programming

group:

Create 3 users tables


Create 3 users tables Miguel Dias Moura
12/21/2005 11:10:00 PM
sql server programming:
Hello,

In my web site I have 2 types of users: students and professors.
All users need to login but the personal information for each user type
has different fields.

So I create 3 tables: professors, students and authentication,
"professors" will have all the personal data from professors.
"students" will have all the personal data from students.
authentication will have the username and password from all users.

How can i link authentication table to both professors and students
tables so when the user logins i get the data from that user, either a
professor or student?

And is the right way to do this?

I am using SQL 2005 and Asp.Net 2.0

Thanks,
Miguel
Re: Create 3 users tables Hugo Kornelis
12/22/2005 12:24:20 AM
[quoted text, click to view]

Hi Miguel,

I would use one Persons table to hold information that applies to both
professors and students. Specific information then goes in the students
and the professors tables.

Login information could go in the Persons table, but is probably better
placed in a seperate table (for reasons of security, but also for
flexibility - maybe, someone will someday need two seperate accounts,
then you'll be ready for it).

The tables Persons, Students and Professors all have the same primary
key; this same column is also foreign key in the Students and Professors
table, in both cases referencing the Persons table.

The Logins table has userid as primary key (of course) and has also a
foreign key that referenced the Persons table.

Best, Hugo
--

AddThis Social Bookmark Button