Data manipulation in the programming or database

Asked

Viewed 49 times

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

  • 1

    I believe that it should already store the information already processed.

  • 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.

  • 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

  • 1

    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.

1 answer

1

What is right or wrong always depends a lot on viewpoints.

What I recommend is that the data be stored in the database, and the entire business rule be made in code.

'Cause if you ever need to change databases, you don’t have to change the business rule.

Browser other questions tagged

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