Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
To get the max median spend in a zip code the query is:
select max(median_amt) from pyw137_median_trxn_by_zip;
To join the two tables into a new one:
create table pyw137_median_trxn_with_income
stored as textfile
location '/user/pyw137/median_trxn_with_income/'
as select trxn.*,income.median_income,income.num_people
from pyw137_median_trxn_by_zip trxn
inner join pyw137_income_by_zip income
on trxn.mrch_pstl_cd = income.zip;
To extract the data into a CSV:
insert overwrite local directory '/home/pyw137/project_data/joined_data'
row format delimited
fields terminated by ','
select * from pyw137_median_trxn_with_income;
Then (outside of Hive):
cd /home/pyw137/project_data/
mv joined_data/000000_0 joined_data.csv