database modeling

0

I have the following diagram,

I have 2 questions.

1) a user has variables, these variables are times, errors and others, so that the change is flexible, should he create another intermediate table?

2) a user has errors and times, but has different times, (has 3 times) should create 3 tables? for the 3 times or to differentiate them is it good that I base myself on the attribute variableB ?

    
asked by hubman 09.02.2017 в 16:57
source

1 answer

1

According to what you describe, the first scheme is fine, except that your tables of times and errors should have a id_usuario that was a foreign key (since a time or an error can not belong to anyone).

You do not need an intermediate table. If you had the field that I tell you, and would like to retrieve the user 1 times:

SELECT usuario.id_u, usuario.nombre, errores.*
FROM usuario JOIN errores on usuario.id_u = errores.id_usuario

And the same with the times.

Now, if the variety of times is limited, and you want to normalize your model, then the structure of the times table should be

id_t  | id_tipo_tiempo | valor_tiempo    

And have a dictionary table that translates the id_type_time to its value in text.

id_tipo_tiempo   nombre_tiempo
1                tiempo de presion
2                tiempo de realce
3                tiempo entre teclas

This last one is a normalization that probably will not be necessary if you are doing only a proof of concept.

    
answered by 03.03.2017 / 19:08
source