EXAMPLE - EXCLUDES EXPRESSION

EXAMPLE - EXCLUDES EXPRESSION

You could use the CASE function in a SQL statement where the expression is omitted.
SELECT
CASE
  WHEN a < b THEN 1
  WHEN supplier_type = 'clothing' THEN 2
  ELSE 3
END
FROM suppliers;
In this CASE function example, an expression has not been included so each condition is individually evaluated and can be completely different and unique. When a condition is met, the corresponding value would be returned.
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