两个查询出来的结果一样吗?理解exists的判断条件。
select 1
from dual d
where exists(
select 1
from dual d2
where d.DUMMY=d2.DUMMY
and 1=2
)
/
select 1
from dual d
where exists(
select count(*)
from dual d2
where d.DUMMY=d2.DUMMY
and 1=2
)
下边的查询结果一样吗? count是如何计数的。
create table tj.temp_test(id number(8),name varchar2(20));
insert into tj.temp_test(id) values(1);
select count(*) from tj.temp_test;
select count(*) from tj.temp_test;
select count(case when id=3 then 4 end) from tj.temp_test;
insert into tj.temp_test(id) values(1);
select count(*) from tj.temp_test;
select count(*) from tj.temp_test;
select count(case when id=3 then 4 end) from tj.temp_test;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25323853/viewspace-746845/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25323853/viewspace-746845/