Apache Hive command

60 Views Asked by At

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

enter image description here

1

There are 1 best solutions below

1
On

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.