谷粒影音8道SQL题(各种Top N)

data表字段

videoId string 				comment "视频唯一id", 
uploader string comment "视频上传者",
age int comment "视频年龄",
category array<string> comment "视频类别",
length int comment "视频长度",
views int comment "观看次数",
rate float comment "视频评分",
ratings int comment "流量",
comments int comment "评论数",
relatedId array<string> comment "相关视频id"

user表字段

uploader String				comment "上传者用户名",
videos int comment "上传视频数",
friends int comment "朋友数量",

8道题目(思路)

统计硅谷影音视频网站的常规指标,各种TopN指标:

  1. 统计视频观看数Top10
  2. 统计视频类别热度Top10
  3. 统计视频观看数Top20所属类别
  4. 统计视频观看数Top50所关联视频的所属类别Rank
  5. 统计每个类别中的视频热度Top10
  6. 统计每个类别中视频流量Top10
  7. 统计上传视频最多的用户Top10以及他们上传的视频
  8. 统计每个类别视频观看数Top10
Author: Tunan
Link: http://yerias.github.io/2018/11/02/hive/2/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.