hive简单数据分析

简单查询分析

select brand_id from user_log limit 10; -- 查看日志前10数据

好像也没啥,和SQL相同,,limit取前多少条  , as取别名

查询条数统计分析

count()聚合函数

select count(*) from user_log; -- 用聚合函数count()计算出表内有多少条行数据

distinct不重复

select count(distinct user_id) from user_log; -- 在函数内部加上distinct,查出user_id不重复的数据有多少条

where .. and .. 添加限制条件

select count(*) from user_log where action='2' and brand_id=2661;

猜你喜欢

转载自blog.csdn.net/qq_38723677/article/details/82702807