4
I’m creating a data model where a client entity is also a person, legal or physical. However, in the state in which it is found it will not be possible to implement it physically, because I am not able to create the logical model that correctly describes a way to have an entity inherit attributes from two different entities. Behold.
First, I made the conceptual representation of the situation described in the following way:
The duplicity of some attributes can be seen as a conceptual model. Unfortunately in the bibliography that I’m using for data modeling there is no situation-example where an entity has more than one "is-one" relationship, so I don’t know if this conceptual model is correct, this may be the cause of the error in the logical model, described below:
Client table and its respective join table.
Physical and legal persons tables, respectively:
The problem is that to implement this model, I don’t know what I should do so that a client is just a type of person, physical or legal. My teacher suggested that I create an entity "Pessoa", instead of two (legal and physical), but I found the same problem, because an entity person should have the attributes CPF and CNPJ, at the same time.
Note: I will implement the BD in SQL Server 2014 and the application will be programmed in VB.NET.
Thank you for your attention.
Yeah, thanks for the suggestion. This is my first data model, I’m learning a lot from books so it’s not very clear how concepts apply in practice. The question is that I imagined that in the database is that I would distinguish whether the client is a natural or legal person but from what you told me it seems that this I will define in the application, isn’t it? Also, I would like to know more about how you like to work on ID’s instead of CPF...
– Ezequiel Barbosa
CPF/CPNJ is unique for each PF/PJ, so what it suggests is to use CPF/CNPJ instead of Ids... that’s right, @bigown ?
– Pedro Laini
@Ezequielbarbosa I didn’t say this, you have to identify in the database what kind of person. You just don’t have to, but you can have a column just for that. That’s your choice. If you have the column it’s easier, but in a way it’s redundant information, depending on how you do it. If you want to know more about something, you should open a question to it.
– Maniero
@Pedrolaini is a possibility, you can use it this way, but I did not suggest it, I just mentioned that it is possible. My suggestion is the ID.
– Maniero