Join or separate repeated columns in different tables

2

I created a tbl_users table.

But I have Profissionais and Empresas that many columns are the same. Would it be interesting to use in the same table, or is it better to separate?

    
asked by anonymous 18.05.2018 / 02:44

1 answer

2

Even with the question not having enough information to give a correct answer, there is something that always counts: normalize the information.

Modeling is defining where each thing goes.

We can talk about DRY here. If the information happens to be the same, but there is no direct relationship between them then everything is right. If it is essentially the same information then one should think about having a separation from the repeating part. At least in logical model.

In physical model there are cases of optimization that end up being more interesting to have the model partially repeated to avoid unnecessary relationships. It's just about performance.

Not the repetition that matters is the functionality that the columns have. It's not the amount of repeated columns that matter.

Let's say you have address columns in each table. Is it worth having the separate address? If it's just to organize the table, it's not worth it. If you want to have addresses as a distinct entity that can be used in more than one entity in the same table or in different tables, then it makes sense to have something like this.

In fact modeling has to start from a correct conceptualization that comes before solving these things. You need to study ontology, taxonomy and even semiotics. For example I would already have changed by understanding these things and not using tbl_ in table names. That is redundancy.

    
18.05.2018 / 03:09