在hive中建表并导入csv文件
create table game(
idNo int,
TotalMoney float,
GameName string,
Genre string,
PlayerNo int,
TournamentNo int,
Top_Country string,
Top_Country_Earings float,
Releaseyear int
)
row format delimited fields terminated by',';
load data local inpath '/home/hsx/ESport_Earnings.csv' into table game ;
csv文件部分内容
1.那个游戏最赚钱 --->Dota 2 2.274199045E8
select GameName,TotalMoney
from game
where TotalMoney in (
select max(TotalMoney)
from game
);
2.那一个国家是电竞大国 --->United States 1.0771858407999998E8
select *
from (
select Top_Country,sum(Top_Country_Earnings) as p
from game
group by Top_Country) as a
where p in(
select max(a)
from (
select sum(Top_Country_Earnings) as a
from game
group by Top_Country) as temp);
3.那个国家人均获得奖金多 ---->Poland 65000.0 1
select *
from (
select Top_Country,sum(Top_Country_Earnings) as a,sum(TournamentNo) as b
from game
group by Top_Country) as pp
where a/b in (
select max(a/b)
from (
select Top_Country,sum(Top_Country_Earnings) as a,sum(TournamentNo) as b
from game
group by Top_Country) as p);
4.策略类游戏的趋势,每年增长率
5.最近一年,什么游戏增长率最强劲