How to model in a correct way

Asked

Viewed 291 times

4

I have the following table structure:

DER

First: it is right this modeling?

Second: is there any way to improve? Reduce the number of tables?

The system will work as follows:

Each Candidate has a Professional Goal. And each Professional Objective can be composed by Shift (Morning / Afternoon / Integral), Days (Monday to Friday), Professions (Analyst... etc...), and Pretensao Salararial. However when filling the Professional Objective the Candidate can select more than one shift / day / profession.

  • 1

    A simple way to reduce the number of tables is to denormalize everything and put the entire system into a meganotary. But that’s bad programming practice. What you have to evaluate is not the number of tables, but the quality of the way the information is organized.

  • In what sense do you want to improve your modeling? In the current way your question is a little too vague pro stackoverflow (in database modeling there is always more of a "right" way of doing things)

  • @hugomg, when referring to improving, was referring to reducing the number of tables,...

  • 1

    Wage pretension is almost always a specific value and eventually a range of values ("I want to win between one thousand and ten thousand"), but not a list of values; so this can be a field of the Objective table instead of being a separate table.

  • @Caffé, in the table Pretensão Salarial, I have ranges of values defined type de 1000 até 2000, I liked the idea of putting a field in the objective table, and for the user I could put a range slider where it would define the desired track...

1 answer

4


As far as you can tell from the description, it’s correct.

It is always possible to reduce the number of tables. A few days ago I saw a case of an entire system that fit in a table :D It can even be with a single column and in most cases in a row :) This is a antipattern called God table, widely used in document-oriented Nosql systems.

It is possible to reduce, but not necessarily advisable.

If the mooring tables will always be accessed through the ObjetivoProfissional, it is possible to delete them and create 3 columns of variable size with the code list of each item. This can be with a VARCHAR, for example, but this is implementation detail. Contrary to what many people imagine, this can be very advantageous bringing little or no disadvantage, depending on what is intended.

Although totally correct, it is outside of what people are accustomed to and can hinder a little the application (it can also facilitate, depends). Surely it will be faster.

Reinforcement that I’m not saying you should do this, but it’s an option that I never rule out.

Whether you need independent access to items tied up without going through ObjetivoProfissional, for example, to see all professionals who have a certain goal, there is better to have the extra tables. Even if it can be solved with the single table, it will be more complicated. It seems to be the case, so leave it as it has modeled.

Browser other questions tagged

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