Modeling Database

Asked

Viewed 223 times

1

good morning!

I have the following problem in user, form and group relationships. In the way that the relationship (CONTEM) was modeled, it will become a table where it will have the user keys, form and group.BUT IF I DO NOT HAVE THE FORM REGISTERED IN THE SYSTEM (HAVING THE USER AND GROUP KEYS), REGARDING FK WHAT WOULD COME OF FORM? BECAUSE THE FORM KEY GOES AS A FOREIGN KEY TO THE TABLE (CONTAINS) BECAUSE THE RELATIONSHIP IS N N.

inserir a descrição da imagem aqui

2 answers

0

Create only the relacioanento table and don’t define the fields as Foreign key, you can store the values normally even if you have only one value.

0


But can’t you set the Form Id to default null? After the form is created, you make the link.

I think if it really is a FK, it should be defined in the bank scheme for performance reasons and ensure the relational model of the bank. But I see no reason not to define it as null.

  • is pq this relation contains will turn a table and the form key cannot be null in this table !! Error! because besides FK it is primary

  • Got it. In case you are setting a requirement. In this case you will need to create the form. By modeling you will need to create the form before filling the "CONTEM". If in your application the form is created at a different time from other entities, I suggest you reformulate your model. The model, as beautiful as it is, needs to meet the business and not the business to meet the data model.

Browser other questions tagged

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