Relationship 1 - 1

Asked

Viewed 983 times

0

I’m having a little trouble designing my relational database model.

The idea follows the following principle::

  • It would have a login system, and for that a table user
  • There would also be 3 types of people who would log into the system producers, suppliers and customers
  • A vendor has relationship with another table called addressee
  • And a producer has to do with another table called data banks

From what I’ve seen, they’re all 1 to 1 but I cannot identify the best way to reproduce a relational model for the problem described.

What I’ve done so far: inserir a descrição da imagem aqui

I do not know if what I did this right or if the links are correct, I remember some concepts spoken by the teacher about weak cardinalities, strong and other things of the kind and I tried to apply these concepts here, but it may be that I do not master them yet.

Can anyone explain to me how best to solve this problem that I have been through, and also explain in general why it is so? Thank you all from now on!

  • Does it seem to me that your relationships are necessarily 1:1 or will all customers necessarily be suppliers? If it can be either customer or supplier then one of the relationships may not exist. (Assuming that when you specify 1 in a relationship you are meaning 1).

  • Note that it does not make much sense to create 1:1 relationships in the conceptual model. In the physical model we may want to separate by type of information.

1 answer

0

Dude, I have two things to tell you. The first is that there is no better way to create a relational model. The second is that there is no right and wrong. When it comes to relational model, you do have some concepts and techniques that help you build one that has become maintainable and elegant, but it doesn’t mean that if you don’t follow them, you will be wrong.


Some points I can observe from your model that you can improve:

  1. Your client entity only has a primary key and a foreign key. It doesn’t make much sense for you to have an entity to store any information. Unless it is an associative entity, such as its "producer".
  2. When creating an entity, you can think this way (it helps me a lot, I don’t know if it will help you): Your "user" entity for example. Be aware that, since you have put "name" as attribute of this entity, there will not be a person in your model that is not user, because you will not be able to name it, since this attribute is user. So what I would do is create a person entity, which relates to the user in a 1 to 1 relation. That person entity would have the name attribute.
  3. Look for good modeling practices, especially for abbreviations, typing, and upper/lower case letters. Avoids redundancy and confusion when returning to the model after a while. Unfortunately, I don’t have a source to indict you because I haven’t read about it in a while, but I believe you still hold yourself to those standards.
  4. Email is an attribute that I would separate into an entity. Just like you did with Endereco. The email has an address, a service (gmail, Hotmail, etc), among others.
  • Thanks for the tips João Victor, I will certainly analyze everything you said and apply in my future models.

  • I found your answer sincerely very much but, very crazy. There are contradictions ... so it is complicated to say yes or no.

Browser other questions tagged

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