You can your db sum columns faster than you can grab the data, parse it, and compute the sum. In query calculations to avoid race conditions from doing the math on separate servers, etc.
Triggers and procedures are a thing.
The nosql/kv store hype missed a lot of stuff relational/sql dbs did well. Mostly because at the time they declared sql was too hard, or just never studied anything.
I think this can be related to what Mel Conway stated in his famous "How Committees Invent?"
> Let us first examine the tendency to overpopulate a
design effort. It is a natural temptation of the initial designer-the one whose preliminary design concepts influence the organization of the design effort-to delegate
tasks when the apparent complexity of the system approaches his limits of comprehension. This is the turning
point in the course of the design. Either he struggles to
reduce the system to comprehensibility and wins, or else he
loses control of it. The outcome is almost predictable if
there is schedule pressure and a budget to be managed.
IIRC, creator of Clojure, Rich Hickey once said that people in general handle things better where there is some variety in symbols used for different things, when you "scan" the code with your eyes. Too much variety -> you end up with explosion of symbols and operators, not good; too little variety -> hard to distinguish things.