Eg: the table
The name age
Two 18
Two 28
Li si 18
Sql1: SELECT a. * FROM table WHERE name='two' or name='bill' and the age 18=
Results: li si 18; Two 18; Two 28
Reason: SQL run first name='bill' and age=18, and then name='two' or (name='bill' and age=18)
Sql2: SELECT a. * FROM the table WHERE (name='two' or name='bill') and the age 18=
Results: li si 18; Two 18
Reason: SQL statements to run in brackets first, and then run the and
CodePudding user response:
Optimization level from high to lowParentheses - & gt; The NOT - & gt; AND - & gt; OR
CodePudding user response:
Priority level not - & gt; And - & gt; orCodePudding user response:
Remember the surest path to add parentheses