简体   繁体   中英

Apache Hive command

I have this question: Show the top 5 game Disciplines for the countries who got more than 10 gold medals.

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;

cloud you please help me with this code to show the top 5 game for each country?

change the code to display 5 games for each country

在此处输入图像描述

Please use the group by and windows function for your required result. In 'numbergold' - Use windows functions like dense_rank so that you can filter on the top 5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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