Data modeling with people of different profiles

Asked

Viewed 79 times

0

I need to create a system where people can play different roles. (e.g. They can be teachers, students and server). The main information is:

Teacher profile: name, address, email, area of activity, discipline, etc. Student profile: name, address, email address, Registration, Course, Country, etc Server profile: name, address, email, capacity, sector, position, level, etc.

The question is: What is the best way to model a database with these tables?

  • A discente may also be docente?

  • 1

    I don’t understand why people think that the fact that a person plays a different role should be someone else. Person is person, the role she has is accessory. It is the same as: http://answall.com/q/191832/101 or http://answall.com/q/54177/101 or http://answall.com/q/80948/101

  • A student can not be a teacher. However, who was a student one day can be a teacher, or server. It’s not just playing different roles. There’s a lot of data about each profile I didn’t put in the question to not make it too big. Ex. Course and registration are exclusive data of the Student. Capacity, position, level are exclusive data of the server. Area of action and discipline are exclusive data of the teacher.

  • In this case, see @Maycon-Pires' reply which is practically what I was going to say: a single table for people and a table for each role they can act on, linked by primary/foreign key pairs.

  • Thank you, @Renefreak.

1 answer

1


You have the following option:

1- Create a Person table with a Primary Key ID. In this table you will have all the common data of people (Teacher and Student).

2- Create a Teaching table that has as a Foreign key (FK) the person’s Id. And add only the teacher’s data.

3- Create a Student table that has as a Foreign Key (FK) the person’s Id. And add only the student’s data.

This is known as specialization.

Hug!

  • 1

    Dear @Maycon Pires, thank you for the reply. Hug.

  • @Renatopaiva model well the database makes it much easier at the time to make reports and create a dimensional database. ABC success!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.