‹ BACK

EXAMPLE - INCLUDES EXPRESSION

EXAMPLE - INCLUDES EXPRESSION

You could use the CASE function in a SQL statement where the expression is included.
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;
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.
Read more: MYSQL: CASE FUNCTION
CASE-Function

To check your knowledge the following tests are recommended:
Check your sql sql skills.