Jen McCown plays around with the AND and OR operators:
Specifically, how is it evaluated when your where clause says “WHERE This AND That OR Something AND that”, without any clarifying parenthesis?
Let’s play around with this. The simplest test scenario is a SELECT 1. If I get a 1 back, that means my WHERE clause evaluated to true, right? Right.
Parentheses should clarify statements. If I see an “AND” and an “OR” in a WHERE clause, I want to see parentheses, even if you’ve gotten it right. It’s too easy to misinterpret precedence.
I agree entirely. It wasn’t the point of the post, but it’s definitely applicable.