mysql>
CASE
WHEN THEN
[{WHEN THEN }...]
[ELSE ]
END
mysql>
mysql> SELECT CASE 10*2
-> WHEN 20 THEN '20 correct'
-> WHEN 30 THEN '30 correct'
-> WHEN 40 THEN '40 correct'
-> END;
+---------------------------------------------------------------------------------------------------------+
| CASE 10*2
WHEN 20 THEN '20 correct'
WHEN 30 THEN '30 correct'
WHEN 40 THEN '40 correct'
END |
+---------------------------------------------------------------------------------------------------------+
| 20 correct |
+---------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql>