SQL CASE
When you are familiar with CASE, you can make your SQL statement more flexible and reduce redundant semantics. CASE can be categorized into two cases. One is simple case CASE WHEN condition THEN result [WHEN···] [ELSE result] END; and the other one is searched case CASE expression WHEN value THEN result [WHEN···] [ELSE […]