SQL order of precedence Given a query ending in where a and b and c or d, will this behave as where (a and b and c) or d, or where a and b and (c or d)? (Or something else?)

I've read the docs and they seem to suggest it would be the former as and has a higher precedence than or, but my results seem to performing the latter so I'm wondering if I'm either misunderstanding the docs or else I'm not generating the query correctly (via an ORM).
If the query purpose is unclear, then you should make it clear.

You don't want to be relying on some relatively obscure ordering rules to get it right. You can't rely on them always staying the same throughout different versions of the same product, or if the underlying technology changes (e.g. Oracle -> MySQL).

If you want it to behave in one way, make it explicit how you want it to behave by using parentheses.