Comparison
For keyword matching on a text column,
contains_tokens
is index-accelerated where LIKE is not. Reach for LIKE only when you need
its wildcard semantics.Logical
AND, OR, NOT. Three-valued: a comparison against null is unknown, and
NOT unknown is still unknown. A WHERE clause keeps only rows where the
predicate is true, so unknown behaves like false there, but not inside NOT IN, which is the usual place this bites. See
Subqueries.
Arithmetic
+ - * / %, with the usual precedence. String concatenation is ||.
Literals
Identifiers are quoted with double quotes when they need to be (a reserved word
or a name with mixed case):
SELECT "order" FROM "MyTable".
Casting
TRY_CAST returns null instead of erroring on a value that
will not convert, which is the one to use over a column you do not control.
Precedence
Highest to lowest::: → unary - → * / % → + - → || → comparison →
IS → NOT → AND → OR.
Parenthesize anything mixing AND and OR. a OR b AND c is a OR (b AND c),
which is rarely what was meant.