This question already has an answer here:
I'm a student of systems engineering, and all my teachers and friends (that actually work in the area) say that it is better to have as much logic as possible implemented in the database (queries, views, triggers, T-SQL, etc.). I think that it's better to have it in the code.
Their reasons are:
If they need to change the language, almost all logic will be in the database; therefore the time of implementation will be minimal.
Changes in the language are more common than in the database.
My reasons are:
It is obvious (in the current environment of my country at least) that they do not change the language of the projects that "easily." (I've seen programs that are still in FoxPro, because if it works, there is no need to change it).
Programming languages are about functionality, while databases are about data. You can have programming functionality in databases, but I think that it should be limited to the components that affect data.
It is easier to implement new requirements (for example: If the customer wants an API).
Normally when they use logic in the database, the rest of the logic that is implemented in the code is more spaghetti-like (random functions, for example).
Generally, it is more usual to have more programmers than database administrators (DBAs).
Which implementation is the best?