一个产品表
如果
select * from product where 产品名='book'
得到 产品名=book的所有记录但为什么select * form product as a where exists(select * from product where 产品名='book')
得到却是全部的纪录呢
望高人给与指点啊。
最后剩10分了,不好意思啊
如果
select * from product where 产品名='book'
得到 产品名=book的所有记录但为什么select * form product as a where exists(select * from product where 产品名='book')
得到却是全部的纪录呢
望高人给与指点啊。
最后剩10分了,不好意思啊
select * from product where 产品名='book')有返回结果则条件成立
那么,select * form product as a的结果当然是所有记录相当于
select * form product as a where 1=1
select * form product as a where exists(select * from product where id>a.id)
得到的却是1,2,条纪录呢
这里id是自增的编号,比如说是1, 2, 3
难道id>a.id不是等于id>1 or id>2 or id>3 吗
如果不是那id>a.i要做何解呢
select * form product as a where exists(select * from product where id>a.id)
得到的却是1,2,条纪录呢
----------------------------------
楼主把3代入进去看看
select * form product as a where exists(select * from product where id>3)
因为exists(select * from product where id>3)里面id只有2>1,3>2,不可能3>3
所以id=3的不成立