CASE is a variant of IF that is useful when all the branch decisions depend on the value of a single expression. : CASE « Function « SQL / MySQL






CASE is a variant of IF that is useful when all the branch decisions depend on the value of a single expression.

      

CASE expression
WHEN value1 THEN
commands;
[WHEN value2 THEN
commands;]
[ELSE
commands;]
END CASE;

   
    
    
    
    
    
  








Related examples in the same category

1.CASE() Function
2.The next version of the CASE() function
3.CASE Branching
4.Using case in select statement
5.Use both case expressions shown previously in a SELECT statement.
6.Using the comparison value form of CASE...WHEN
7.Using CASE...WHEN for evaluating conditions
8.Variants of CASE.WHEN with no ELSE clause
9.Use a CASE...WHEN function to indicate that the different categories have different sales trends
10.Case without else clause
11.Nested case statement
12.Case with comparison
13.Case when with and operator
14.Provide more meaningful value with case clause
15.Make more complete value with case statement
16.Using case statement to check a range
17.Use case else to check the exceptions
18.Using case with comparison
19.Case clause and aggregate function
20.If ELSE is omitted, the null value is returned.