CASE checks WHEN branches in order.

highlighted = computed this step

WHEN conditions are tried in order

CASE checks its WHEN branches from top to bottom.

ordered WHEN checks\text{ordered WHEN checks}

Read branch count

The expression has 2 WHEN branches.

branches=2\text{branches}=2

CASE-expression examples are tiny finite row transforms with SQL-style TRUE/FALSE/UNKNOWN logic; SQL dialect completeness, type coercion, optimizer behavior, indexing, and product claims are out of scope.

WHEN conditions are tried in order: base rowsnamescorestatusAda90activeBea40activeCalNULLactiveDee70paused CASE branch evaluationsourcevaluesevaluationsresultresultSource0[Ada, 90, active][{branch:0, truth:TRUE, chosen:yes}, {branch:1, truth:TRUE, chosen:no}]highbranch 01[Bea, 40, active][{branch:0, truth:FALSE, chosen:no}, {branch:1, truth:FALSE, chosen:no}]lowELSE2[Cal, NULL, active][{branch:0, truth:UNKNOWN, chosen:no}, {branch:1, truth:UNKNOWN, chosen:no}]lowELSE3[Dee, 70, paused][{branch:0, truth:FALSE, chosen:no}, {branch:1, truth:TRUE, chosen:yes}]midbranch 1 CASE output rowsnamescorestatusbucketAda90activehighBea40activelowCalNULLactivelowDee70pausedmid CASE factsfactvalueinputRowCount4branchCount2outputRowCount4firstTrueRows2elseRows2nullElseRows0unknownSkipped2rowOrdersource_order

Top branch first

The high-score branch is checked before the mid-score branch.

first branch first\text{first branch first}

Summary

Order matters because the first TRUE branch wins.

order matters\text{order matters}