oracle 的 exist,oracle exist 语句

时间:2025-01-29 08:45:56

EXISTS里的子查询结果集非空,EXISTS()子句的值就是true。

EXISTS里的子查询结果集为空,EXISTS()子句的值就是false。

NOT EXISTS里的子查询结果为非空,NOT EXISTS()字句的值是false

NOT EXISTS里的子查询结果为为空,NOT EXISTS()字句的值是true

例如:

select * from emp where not exists (select * from emp a where = 1131001 );

能查到结果集

select * from emp where exists (select * from emp a where = 11001 );

能查到结果集

结论 not exitst 子句为空 能查询到结果集 等价于 exist  子句非空

转自:/blog/699673

感谢分享

原文:/duyunchao-2261/p/