MySQL Control Flow Functions and Expressions

MySQL Control Flow Functions and Expressions

 MySQL Control Flow Functions and Expressions



The control flow functions allow you to add if-then-else logic to SQL queries without using the procedural code. The following show the most commonly used MySQL control flow functions:

  • CASE – return the corresponding result in THEN branch if the condition in the WHEN the branch is satisfied, otherwise, return the result in the ELSE branch.
  • IF – return a value based on a given condition.
  • IFNULL– return the first argument if it is not NULL , otherwise returns the second argument.
  • NULLIF– return NULL if the first argument is equal to the second argument, otherwise, returns the first argument.
Reactions

Post a Comment

0 Comments

close