现在我有2张表 A,Bcreate table a
(
empId number,
empName varchar2(10)
)create table b
(
empId number,
course varchar2(10)
)表A内容: EMPID EMPNAME
1 a
2 b
3 c表B内容: EMPID EMPNAME
1 aa
2 bb
3 cc我的SQL语句如下:
select *
from a, b
where
a.empId = b.empId
and (a.empId = 1 or 1 = 9)
and b.course = 'aa'
and 1 = 9我在where条件的最后 加了个恒假式 为什么显示出来的结果却是:
EMPID EMPNAME EMPID COURSE
1 a 1 aa
如果 我把那个恒假式 放在where条件的最前面,显示结果为空。
select *
from a, b
where
1 = 9 and
a.empId = b.empId
and (a.empId = 1 or 1 = 9)
and b.course = 'aa'
如果我把where 中的 “或条件” 里的恒假式 变成恒真式,结果为空
select *
from a, b
where
1 = 9 and
a.empId = b.empId
and (a.empId = 1 or 9 = 9)
and b.course = 'aa' 等等...请问各位,Oracle对where条件的解析顺序不是从下至上的吗?
为什么 我增加了个恒假式 他仍然出现结果呢?
为什么 恒假式放的顺序不同 所产生的结果也不一样呢?谢谢
(
empId number,
empName varchar2(10)
)create table b
(
empId number,
course varchar2(10)
)表A内容: EMPID EMPNAME
1 a
2 b
3 c表B内容: EMPID EMPNAME
1 aa
2 bb
3 cc我的SQL语句如下:
select *
from a, b
where
a.empId = b.empId
and (a.empId = 1 or 1 = 9)
and b.course = 'aa'
and 1 = 9我在where条件的最后 加了个恒假式 为什么显示出来的结果却是:
EMPID EMPNAME EMPID COURSE
1 a 1 aa
如果 我把那个恒假式 放在where条件的最前面,显示结果为空。
select *
from a, b
where
1 = 9 and
a.empId = b.empId
and (a.empId = 1 or 1 = 9)
and b.course = 'aa'
如果我把where 中的 “或条件” 里的恒假式 变成恒真式,结果为空
select *
from a, b
where
1 = 9 and
a.empId = b.empId
and (a.empId = 1 or 9 = 9)
and b.course = 'aa' 等等...请问各位,Oracle对where条件的解析顺序不是从下至上的吗?
为什么 我增加了个恒假式 他仍然出现结果呢?
为什么 恒假式放的顺序不同 所产生的结果也不一样呢?谢谢
from a, b
where
a.empId = b.empId
and (a.empId = 1 or 1 = 9)
and b.course = 'aa'
and 1 = 9 像这个语句,中间没有恒真式
无论从上至下,还是从下至少,结果肯定都是null不过8i从来没用过,随便说说