Zest.

SQL: CASE expression

A short, tested SQL example for case expression. Copy it and adjust the names and paths for your project.

SQL
SELECT name,
  CASE
    WHEN score >= 90 THEN 'A'
    WHEN score >= 80 THEN 'B'
    ELSE 'C'
  END AS grade
FROM students;

Find it in Zest

Search for “sql case expression” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More SQL examples

All SQL examples