ITPub博客

首页 > 数据库 > Oracle > A example about exists!

A example about exists!

原创 Oracle 作者:YoungEric 时间:2007-10-08 09:33:29 0 删除 编辑
P.S : http://www.itpub.net/861853,1.html[@more@]SQL> select * from v_test;



ID NAME
---------- ----------

120 hospital



SQL
> select * from v_test_1;



ID G
---------- -

120 M

110 F



SQL
> select a.id,a.name from v_test a

2 where exists
(select null from v_test_1 b where b.id = a.id);



ID NAME
---------- ----------

120 hospital



SQL
> select a.id,a.name from v_test a

2 where exists
(select null from v_test_1 b where b.id <> a.id);



ID NAME
---------- ----------

120 hospital



SQL
> select a.id,a.name from v_test a

2 where exists
(select null from v_test_1 b where b.id = 1);


no rows selected



SQL
> select a.id,a.name from v_test a

2 where exists
(select null from v_test_1 b where b.id <> 1);



ID NAME
---------- ----------

120 hospital

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10484922/viewspace-975038/,如需转载,请注明出处,否则将追究法律责任。

下一篇: About join~!
请登录后发表评论 登录
全部评论

注册时间:2007-12-18

  • 博文量
    79
  • 访问量
    211211