In general, yes, you have to do your heavy lifting in the database. If your data set is quite small, it does not matter if you are performing calculations on the database server or on the database client.
The main consideration, whether to do the calculations on the db server and on the db client, usually has performance. If you are doing heavy computing on a db client, you may need to transfer a lot of data through the db connection. When using large datasets, transferring the entire table to the client can lead to performance problems, and if your database server lives on a different machine than your application server (that is, not local), then the overhead of data transfer becomes even worse.
, , , . SQL , , , , .
, , , , .
, . , , , , , .