Using CASE Statements for Conditional Logic

CASE statements allow conditional expressions directly within queries.


SELECT 
    customer_id,
    CASE 
        WHEN amount > 100 THEN 'High'
        ELSE 'Low'
    END AS customer_category
FROM 
    sales;