A searched CASE expression labels each row using the first TRUE condition.

highlighted = computed this step

Input table

Start with invoice lines and unit prices.

Invoice lines\text{Invoice lines}
Invoice linesline_iditemqtyunit_pricel1notebook215l2pen38l3sticker42

Select query

Evaluate CASE conditions in order and keep the first matching label.

CASE price band\text{CASE price band}
SELECT searched CASE price bandselect line_id,price_bandarity 2 rows 3InvoiceLinesarity 4 rows 3

Output table

Each row receives one price band label.

labeled rows\text{labeled rows}
Outputline_idprice_bandl1premiuml2standardl3small