sql语句优化

来源:互联网 发布:java调用so库 编辑:程序博客网 时间:2024/05/22 17:36
  1. sql语句与orcale语句的where语句的条件执行顺序 : 都是从右到左执行

示例:
  1. mysql:
SELECT * FROM `book` where category is NULL or category='文学' and price>80;     结果是0条
SELECT * FROM `book` where price>80  and category is NULL or category='文学' ; 结果是2条


2.oracle

Select 'ok' From Dual Where 1 / 0 = 1 And 1 = 2;  执行

Select 'ok' From Dual Where 1 = 2 And 1 / 0 = 1;  出错(除数为0)

0 0
原创粉丝点击