SQLite Forum

operator precedence docs missing, suggested clarifications below
I think you've accurately captured my suggestion.

Some examples that might not be obvious

select not 0 between -1 and 2;

select 1 == 3 between -1 and 2;

select 0 between -1 and 2 == 2;

These are simple enough but they are contrived in that if anyone was even remotely in doubt they would just add parentheses.

The reason I happen to care is I'm writing a compiler and I need to be conformant to the SQLite rules.  Hence the details matter to me whereas if I was just coding SQLite I wouldn't care so much, I'd add parens for clarity.

But to make the doc a little better I don't think you have to do much.

You could change it to something like this:

SQLite understands the following operators, in order from highest to lowest precedence:

~ - + (the common unary operators)
*    /    %
+    -
<<   >>   &    |
<    <=   >    >=
=    ==   !=   <>   IS   IS NOT   IN   LIKE   GLOB   MATCH   REGEXP  BETWEEN

The unary prefix operators are these:

-    +    ~    NOT

The remaining operators are binary except for BETWEEN which is ternary.

With that change section 2 becomes your intro/summary section with additional details below if needed.