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
Since students are associated with their professors and vice versa, I would create the realtionship as follows:
Table: Staff
Columns: StaffID, FirstName, LastName, Username, Password
Table: Students
Columns: StudentID, FirstName, LastName, Username, Password
Table: StudentsStaff
Columns: StaffID, StudentID
Each time a student is assigned to a professor, the database will add to the StudentsStaff table the ID of the student and the ID of the professor. Then you will be able to get data representing all the professors a student is enrolled with and all the students a professor has enrolled.
No comments:
Post a Comment