It always depends. But I would say that the most certain is an entity of Pessoa
that may even PessoaFisica
and PessoaJuridica
find it interesting and have other objects with roles that this person exercises in your organization. Almost always having only the roles with repetition of my data of the person in those entities is wrong for keeping different objects in the system for the same real object.
The person is a clear and obvious object of any model. Paper data isn’t always so obvious, you have to think of it as special documents, because they don’t even exist as real objects.
Then there should be tables Cliente
, Colaborador
, Fornecedor
, etc. because the same person may have more than one role.
Conceptually it’s right to have everything separate. If for reasons of performance do not want to have separated even could have the roles next to the object of the person, but this is not universally more interesting even looking only performance. But this is increasingly less necessary because of technologies that behave closer to what memory is like. Mainly on disk can have useful mater a table only, but it is not easy to manage it.
In memory usually would have to keep these objects separate and there does not have much advantage join everything.
But what matters most is the correct concept, with it you can do whatever you need in an organized and easy way, when the concept is wrong all maintenance becomes complicated or almost impossible, except by changing everything completely.
What is almost always wrong is having the tables of the papers and not having the person related, ie repeat the same person in all tables, as almost all systems do, a pity.
Behold What is database normalization?.
Search for partitioning information. You can have a person entity with all common data and global relationships and a derived entity for each type of person with the particular data of each type of person as well as the particular relationships of each type.
– anonimo
Great, I’ll look it up. It’s the form the colleague below suggested as well and the one I was most inclined to use. Thank you very much!
– Rodrigo Teixeira Andreotti