Oracle DISTINCT 子句

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

Oracle DISTINCT 子句用于从结果集中删除重复记录。它只能与 SELECT 语句一起使用。

语法

参数

表达式:它指定您要检索的列。

表:它指定您要从中检索记录的表。

条件:它指定必须满足的条件。

Oracle DISTINCT 示例:(带单个表达式)

让我们以表“customers”为例

Customer 表

Customer Table

执行此查询

输出

oracle distinct query 1

Oracle DISTINCT 示例:(带多个表达式)

执行此查询

输出

oracle distinct query 1

此示例指定客户的 distinct 名称、年龄和工资,其中年龄大于或等于 65。