sql - Database design: Users with roles and profiles with fields for each role -


I want to create a database with the following requirements, but I'm having trouble.

There are 3 types of users: Doctor, registered user, and administrator I can add other types of users in the future. Each of these user types has different profile fields. For example, registered users ( username , password , email , first name , and lastName ). In addition, doctors have previous fields, but they have additional fields ( PhoneNumber , work location , country , state city , ...). These fields may be different for other user types. Some fields are common to every user type, and some are not.

I think I need two tables: users, and roles.

  User table ==== ======== UserID INT Primary key AUTO_INCREMENT Username VARCHAR (50) No password, VARCHAR (100) No email, VARCHAR (50) No , First name VARCHAR (50) No, last name VARCHAR (50) No, not played role INT not // This is the foreign key role table: ============= RoleID INT Primary key AUTO_INCREMENT role Name VARCHAR (50) No   

But how do I apply different profile fields for different user types?

I think you have a table for the user (for your physicians, registered users, and administrators ) And 3 more tables (table part), in which the same will be the same id ( OneToOne relationship) column.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -