SQL 2023 · Querying

Branch inside a query

Compute a value conditionally.

SELECT name, CASE WHEN age >= 18 THEN 'adult' ELSE 'minor' END AS group_name FROM users;

Official SQL 2023 documentation

More querying commands

All querying commands · SQL 2023 cheatsheet

Was this page helpful?