re: You Can Do it in SQL, Stop Writing Extra Code for it VIEW POST

VIEW FULL DISCUSSION
 

I agree with your main point, but not with your arguments. Doing math/string manip/etc in SQL is just not smart. You say it's "writing less code that has to be maintained", but that SQL code doesn't just magically go into some compartment where it doesn't have to be maintained too. And honestly, SQL is harder to maintain than whatever your application is written in.

Now, the really big thing that you didn't touch hard on is that you should NOT be doing any sort of inter-table data manipulation in SQL. The DB server software knows how to do this more efficiently than your code does, so you should be offloading that whenever possible. That's the real benefit in putting the functionality into SQL instead of your application.

 

I am not telling to put the SQL in the db, it will be in code tracked with git and potentially unit tested. If that does not aid maintainability I am not super sure what will :).

I agree with your 2nd point generally. Thanks!

code of conduct - report abuse