asp.net - User Structure, Multiple User Types -
i developing new database / web application our school. need supply little bit of background information make question little more relatable.
there many different user types access application each needing access different parts of application different permissions each “zone” may able access.
for example:
a student can login , access there information , update details download copies of reports (so can see information)
a teacher can login , access there information , students teach
a manager can login , access there information , teachers , students manage
there bunch of other login types question not important technically more users not have or require own table information.
i have part decided on structure happy with, keep changing mind on how think following best done.
i have user table (user_t) relevant user information stored, (username, password, etc.)
however have separate tables of user types (eg, student, staff, etc), necessary because student needs have different information stored staff member. here problem lies, of users have of same basic fields (first name, last name, birthdate, gender, etc.).
should store these in user_t table? or in individual tables?
if store them in user_t table makes easier have application pull information , allow them update, on down side when displaying student details example, need reference user_t students name etc.
i in mindset best option have separate tables fields , join them in view user_v, field indicates origin of data when update preformed can applied against appropriate table.
thoughts?
sounds there separation using user_t table general "people" profile table , other tables unique role specific data. user_t store more general info person , id in table perhaps foreign key called "person_id" in other tables.
going table schema depend on how might query shared general data together. example, if plan search name or email without knowing type/role (whether staff, student, etc), have general people information in user_t table apart other information. if knew role/type, choose corresponding table search in , join needed user_t data. if don't separate tables way, left using view or union allow search on general columns single query, in opinion more troublesome optimize.
user_t table: id, first_name, last_name, email, gender, birthdate, role, ... students table: id, person_id, gpa, ... staff table: id, person_id, staff_type, hire_date, ...
Comments
Post a Comment