Relationship with the same MER entity

Asked

Viewed 336 times

1

I am developing my tcc and came across the following doubt in my MER(Relationship entity model).

I have a client entity that pays another client, but just as I represent it in the ER?

Like that’s what I’m talking about:

CLIENTE (nenhum,muitos)  ---- PAGA ---- (nenhum,muitos) CLIENTE

That’s the way it would be?

  • Wouldn’t this be a self relationship? Client > Pays > Client, the way you described it. However, it is not necessary to create another entity, the association arrow back to the client itself,

  • It crossed my mind, but the examples I see only show things related to customer > supervise > client, things like that. And another, the relationship would also become a table because of the cardinality. Is there a problem when I put foreign keys inside the PAID table?

  • No problem. Even the primary keys of the generated table can be composed by the id of the payee and the id of the payee.

  • Okay, thank you buddy.

  • Related: https://answall.com/q/214625/64969

1 answer

1

The book claims to be a recursive relationship.

I believe it is possible to make a comparison with the example of the book inserir a descrição da imagem aqui

I drew a drawing in the draw to represent the answer. inserir a descrição da imagem aqui

In this way it is possible to represent that there are N clients who receive remuneration from other clients, and that there is at least 1 client who assumes the position of remunerator.

It is worth noting that the number "1" on the payer side indicates that in one transaction there can only be 1 person who is paying the other, that is, there is no 2 or more people make a payment to the same person in the form of a single record (this makes no sense)

If a (paid) person is receiving an amount of more than one person (paid), then there must be 2 separate records of payment.

The answer came from the book:Database systems 5th edition Authors: Elmasri, Ramez Navathe, Shamkant B. Year: 2011

  • Congratulations on the honesty of putting the source :-)

Browser other questions tagged

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