当前位置:K88软件开发文章中心大数据impala → 文章内容

impala DISTINCT运算符

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-26 10:08:08

由 jojocool 创建,youj 最后一次修改 2016-12-19 Impala中的distinct运算符用于通过删除重复值来获取唯一值。 语法以下是distinct操作符的语法。 select distinct columns… from table_name;例假设我们在Impala中有一个名为customers的表,其内容如下 - [quickstart.cloudera:21000] > select distinct id, name, age, salary from customers; Query: select distinct id, name, age, salary from customers在这里您可以观察客户Ramesh和Chaitali输入两次的工资,并使用distinct运算符,我们可以选择唯一值,如下所示。 [quickstart.cloudera:21000] > select distinct name, age, address from customers;执行时,上述查询给出以下输出。 Query: select distinct id, name from customers+----------+-----+-----------+ | name | age | address | +----------+-----+-----------+ | Ramesh | 32 | Ahmedabad || Khilan | 25 | Delhi | | kaushik | 23 | Kota | | Chaitali | 25 | Mumbai || Hardik | 27 | Bhopal || Komal | 22 | MP | +----------+-----+-----------+Fetched 9 row(s) in 1.46s

impala DISTINCT运算符