MySQL have several Control Flow Functions listed as below:
Control function returns value based on each row processed by the query executed. Control functions can be used on SELECT, WHERE, ORDER BY and GROUP BY statements.
We can say this is just like the switch case in programming languages.
This function takes the three parameters as expression, if expression one is true the it will return second parameter otherwise it will return third parameter.
This function takes two parameters as a expression. And if expression one is not num then it will return expression one otherwise it will return expression two.
This function takes two parameter as a expression. It will return NULL if expr1=expr2 will return TRUE otherwise it will return expr1.
Note: MySQL evaluates expr1 twice if the arguments are not equal.
Avinash Zala currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.
View all posts by: Avinash