简体   繁体   English

Apache Hive 命令

[英]Apache Hive command

I have this question: Show the top 5 game Disciplines for the countries who got more than 10 gold medals.我有这个问题:显示获得超过 10 枚金牌的国家的前 5 名比赛纪律。

my code is: select distinct t.discipline, m.team from teams t join medals m on (t.noc=m.team and m.numbergold>10) order by m.team;我的代码是:select distinct t.discipline, m.team from teams t join medals m on (t.noc=m.team and m.numbergold>10) order by m.team;

cloud you please help me with this code to show the top 5 game for each country?云 请帮我用这个代码来显示每个国家/地区的前 5 名游戏?

change the code to display 5 games for each country更改代码以显示每个国家/地区的 5 场比赛

在此处输入图像描述

Please use the group by and windows function for your required result.请使用 group by 和 windows function 获得您需要的结果。 In 'numbergold' - Use windows functions like dense_rank so that you can filter on the top 5.在“numbergold”中 - 使用 windows 函数,如 dense_rank,以便您可以筛选前 5 个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM