SQL evaluates AND before OR. Put alternatives inside parentheses when a separate condition must apply to both. Check the staging rollback in the log to see why the grouping matters.
SELECT id FROM deployments
WHERE service = 'api'
AND (environment = 'staging' OR environment = 'development');Show only the IDs of production deployments with status failed or rolled_back. Practise writing the status alternatives with OR inside parentheses.