ORACLE EXISTS

2025 年 3 月 17 日 | 阅读 1 分钟

在 Oracle 中,exists 子句用于 select、insert、update、delete 语句。 它用于组合查询和创建子查询。

语法

参数

子查询: 这是一个返回至少一个记录集的 select 语句。

表 1

ORACLE EXISTS

表 1

ORACLE EXISTS

示例 1

查询: select name from table1 where exists (select *from table2 where table1.id=table2.id)

ORACLE EXISTS

示例 2

查询: select id, salary from table2 where exists (select *from table1 where table2.id=table1.id)

ORACLE EXISTS

示例 3

查询: select * from table1 where not exists (select *from table2 where table1.id=table2.id)

ORACLE EXISTS
下一主题IN