I have a question in the structure of some tables and I hope you can clarify in detail below.
Scenario
The system will generate a way to create dynamic forms and questions in order to be answered by users already registered. Responses should be stored too.
A form can be associated with N clients, in the same way that a client can be associated with N forms. Only the forms associated with the user can be answered. The forms will have a set of questions and another table should be provided for each user's response.
Doubt
The form must be associated with the user to allow him to respond, so I created two diagrams. Which one is the best one to use?
Diagram 1
The Usuario_Formulario
table is associated with the forms that each user can respond to and in the Resposta
table, will store each user's answer (referring to the form-question).
Diagram2
Inthisseconddiagram,IremovethedirectrelationshipfromUsuario
-Resposta
andmaketherelationshipappearbetweenUsuario_Formulario
-Resposta
Is there any better way to create this structure? You can tweak the relationships and keys of each table.
OBS: Do not take into account non-key field issues, just create some to give a better view of the problem.