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 theWHEN
the branch is satisfied, otherwise, return the result in theELSE
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.
0 Comments
CAN FEEDBACK
Emoji