CASE with case-sensitve comparison : CASE « Control Flow Functions « MySQL Tutorial






mysql>
mysql> SELECT CASE BINARY 'B'
    ->        WHEN 'a' THEN 1
    ->        WHEN 'b' THEN 2
    -> END;
+---------------------------------------------------------------------+
| CASE BINARY 'B'
       WHEN 'a' THEN 1
       WHEN 'b' THEN 2
END |
+---------------------------------------------------------------------+
|                                                                NULL |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>
mysql>








18.2.CASE
18.2.1.CASE with value
18.2.2.CASE with condition
18.2.3.CASE with case-sensitve comparison
18.2.4.Using CASE to switch the employee id
18.2.5.A SUM() function can be added to CASE statement to give us the total