NOT Operator Optimizations

From InterBase

Go Up to Understanding SQL Expressions

Starting with InterBase 2020 conditions using NOT operators have been optimized, a condition like NOT A>0 can be transformed to A<=0 so an index on column A can be used. All inequality operators <, <=, !=, <>, >, >= can also be transformed and optimized. Additionally, all NOT conditions can be transformed recursively when possible.

For example:

F1 NOT BETWEEN val1 AND val2

Transforms to:

F1 < val1 OR F1 > val2

Advance To: