Determining the Order of Evaluation

Precedence determines the priority of various operators when more than one operator is used in an expression. Operators with higher precedence are evaluated first. Arithmetic operators (+, -, *, and so on) have higher precedence than comparison operators (<, = , >, and so on), which have higher precedence than logical operators (NOT, AND , OR), so this expression:

a or b * c >= d

is equivalent to this one:

a or ((b * c) >= d)

Operators with lower precedence are less binding than those with higher precedence. Table 5.2 lists operator precedences from most to least binding. Operators in the same row have equal precedence.

Associativity determines the order of evaluation in an expression when adjacent operators ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.