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

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
SQL snippets
Cosmo
Sign Up Now
or Subscribe for future quizzes