0
Assuming I need to handle a given example I get weight and height from a user. I want to calculate her BMI to enter into the database. This BMI calculation must be done in a function in the code, or through a Trigger in S.G.B.D
My boss who’s the manager of Information Management told me that this kind of checking is done on the B.D
But the teacher said that the correct thing to do is to calculate the code and only send the ready data to the bank
I believe that it should already store the information already processed.
– Doan Casotti
I understand the same thing as Doan. The business rule should be in the code and not in the database that is only in charge of maintaining and collecting the information and ensure that no information is entered incorrect if the code makes incorrect insertions.
– NDelavi
It will help you a lot: https://answall.com/questions/15739/regras-de-neg%C3%B3cio-no-banco-de-dados-quais-as-vantagens-e-disadvantages
– George Wurthmann
To calculate the BMI, in my opinion use Trigger it would be absurd. It is simpler to use a column calculated in the database, which automatically recalculates the BMI with each change in the formula values. Or else make the calculation in the code and store in the database.
– José Diz
Possible duplicate of Business Rules in the Database - what are the advantages and disadvantages?
– Roberto de Campos