Hive sql面试笔记

Hive sql面试,教训惨痛,特此记录

select store,count(distinct uid) as uv from Visit group by store;

select * from Users order by age desc, total;

select  stage_someone, count(distinct UID)  from  LifeStage  lateral  view  explode(split(stage,','))  LifeStage_tmp  as stage_someone  group  by  stage_someone;

考点:行转列

select UID,concat_ws(',',collect_set(stage)) as stages from LifeStage group by UID;

考点:列转行

你可能感兴趣的:(大数据)