Oracle where语句中and,or,not的执行顺序


Oracle where子句里面的and,or,not:

1.a and b(顺序执行)

      (1)a,b同true则true,

      (2)a,b一false则false,

         [1]若a为false,就没有必要在进行后面的判断了,整个表达式必为false;

         [2]若a为true,则进行后面的判断,b为true则表达式为true,若b为false,则整个表达式为false;

2. a or b(顺序执行)

       (1)a,b一true则true

          [1]若a为true,就没必要在进行判断了,表达式为true;

          [2]若a为false,继续判断b,若b为false,表达式为false;若b为true,则表达式为true;

       (2)a,b同false则表达式返回false

          此情况下,a为false,然后b也为false;

3.not a(先执行a,在取反)

      取反

      a->true, not a->false;

      a->false, not a->true;

相关内容