· 6 years ago · Jan 08, 2020, 09:56 AM
1#!/bin/bash
2
3#ETAP 2
4# CREATE etap1 database
5hive -e "Create IF NOT EXISTS DATABASE etap2"
6
7# CREATE MAX Votes in Year table
8hive - e "CREATE TABLE IF NOT EXISTS etap2.max_votes_year AS SELECT startyear, max(numvotes) as maxvotes FROM etap1.title_ratings_years GROUP BY startyear ORDER BY startyear;"
9
10# CREATE MIN Votes in Year table
11hive - e "CREATE TABLE IF NOT EXISTS etap2.min_votes_year AS SELECT startyear, min(numvotes) as minvotes FROM etap1.title_ratings_years GROUP BY startyear ORDER BY startyear;"
12
13# CREATE MIN averagerating in Year table
14hive - e "CREATE TABLE IF NOT EXISTS etap2.min_ratings_year AS SELECT startyear, min(averagerating) as minratings FROM etap1.title_ratings_years GROUP BY startyear ORDER BY startyear;"
15
16# CREATE MIN averagerating in Year table
17hive - e "CREATE TABLE IF NOT EXISTS etap2.max_ratings_year AS SELECT startyear, max(averagerating) as maxratings FROM etap1.title_ratings_years GROUP BY startyear ORDER BY startyear;"