Home > database >  Oracle and and or
Oracle and and or

Time:10-13

In Oracle SQL steps in the or and and have a priority, and the priority of the above or,
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 low

Parentheses - & gt; The NOT - & gt; AND - & gt; OR

CodePudding user response:

Priority level not - & gt; And - & gt; or

CodePudding user response:

Remember the surest path to add parentheses
  • Related