Database Model

1

I have the following database model in 4 tables. The first, "person", with the following elements: id, name, surname, ID, email. The second, called "user", with id, id_person, id_department, id_sede, name, password, type. The third, called "headquarters", with id and name and the last one, called "department", with id, id_sede and name.

What would be the way to do it well, if I'm doing it wrong? I start to do the design, but I'm not very good as you see.

My doubt as such is that if doing so would take me less time to make a code to effectively search the data you enter it.

    
asked by Juan Ortiz 20.03.2018 в 16:06
source

1 answer

2

The main arrangement I see necessary in your data model is to have the id_sede column in the usuario table.

Depending on your data model, a department has a series included, so the usuario only needs to have the id_departamento . As it is, nothing prevents that at the database level you have a user with a id_sede and a id_departamento that has another id_sede , generating an inconsistency in the data.

    
answered by 20.03.2018 в 16:13