Does Mysql: if judge whether it is better to write at the business layer or at the database layer?

if in the business layer, within a transaction, there is an if judgment
read in the database first, judge according to the result if else, and then read / write to the database

and there are if else statements within the mysql database

if you are in the business tier, you need to send two sql requests
to the database and put them inside the database, then you only need to send the sql statement once

.

which is better?

Mar.02,2021

is not good.
see if there is too much data in your database.
if there is a lot of data and performance is required, then a sql solves the problem.
but it is usually written in the business layer.

Menu