EXAMPLE - INCLUDES EXPRESSION
EXAMPLE - INCLUDES EXPRESSIONYou could use the CASE function in a SQL statement where the expression is included.
In this CASE function example, the expression is quantity whose value would be compared to each of the conditions until one is met. Then the corresponding value would be returned by the CASE function.
SELECT supplier_id, CASE quantity WHEN > 10 THEN 'The quantity is greater than 10' WHEN = 10 THEN 'The quantity is 10' ELSE 'The quantity is something else' END FROM suppliers;
Read more: MYSQL: CASE FUNCTION