mysql n realised it to has the 'if', 'while', functions etc. you can use all this to build ur logic is it a good idea to do so | Sololearn: Learn to code for FREE!
0

mysql n realised it to has the 'if', 'while', functions etc. you can use all this to build ur logic is it a good idea to do so

will placing logic or 'to much' logic on the database affect it in anyway: "slow down queries when lots of queries come in

8th Feb 2019, 7:54 AM
mpumelelo hlongwane
mpumelelo hlongwane - avatar
3 Answers
+ 2
You can use flow control statements in MySQL only within stored programs. For most things a simple (or complicated) select statement should be sufficient to get the data you need from the database. Stored programs can help out when this is not enough, for example if you need to perform complex transformations on your data. If there is a choice to implement this in sql or in the programming language that will use the data, I would consider if the transformation changes the size of the data significantly. If Yes, it may be worth to do it in database level. But another aspect can be better maintenance of your code, better if it is all done in one place in a single language.
12th Feb 2019, 6:17 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Yes that was my point.
12th Feb 2019, 8:46 AM
Tibor Santa
Tibor Santa - avatar
0
Tibor thanks for that.... so jus to see if I understanding u, if the size of the data will be afftected do it on the database cos the transmission of a larger data will be slower!?
12th Feb 2019, 7:34 AM
mpumelelo hlongwane
mpumelelo hlongwane - avatar