课程表

Impala 基础

Table 特定语句

Impala 子句

工具箱
速查手册

impala DISTINCT运算符

当前位置:免费教程 » 大数据/云 » Impala

Impala中的distinct运算符用于通过删除重复值来获取唯一值。

语法

以下是distinct操作符的语法。

  1. select distinct columns from table_name;

假设我们在Impala中有一个名为customers的表,其内容如下 -

  1. [quickstart.cloudera:21000] > select distinct id, name, age, salary from customers;
  2. Query: select distinct id, name, age, salary from customers

在这里您可以观察客户Ramesh和Chaitali输入两次的工资,并使用distinct运算符,我们可以选择唯一值,如下所示。

  1. [quickstart.cloudera:21000] > select distinct name, age, address from customers;

执行时,上述查询给出以下输出。

  1. Query: select distinct id, name from customers
  2. +----------+-----+-----------+
  3. | name | age | address |
  4. +----------+-----+-----------+
  5. | Ramesh | 32 | Ahmedabad |
  6. | Khilan | 25 | Delhi |
  7. | kaushik | 23 | Kota |
  8. | Chaitali | 25 | Mumbai |
  9. | Hardik | 27 | Bhopal |
  10. | Komal | 22 | MP |
  11. +----------+-----+-----------+
  12. Fetched 9 row(s) in 1.46s
转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号