SELECT player_name,weight, CASE WHEN weight>250 THEN 'over 250' WHEN weight>200 THEN '201-250' WHEN weight>175 THEN '176-200' ELSE '175 or under' END AS weight_group FROM benn.college_football_players
ALTER TABLE "public"."_students" ADD COLUMN "race" int4
ADVANCED HIVE?
95% SQL syntax, but can query Hadoop turning HiveQL into Map Reduce Jobs
Explode
Make a new row for each list entry
adid_list is an Array of ints
pageid | adid_list becomes=> pageid | adid
1 | [1,2] 1 | 1
1 | 2
SELECT pageid, adidFROM pageAds LATERAL VIEW explode(adid_list) adTable AS adid;
HIVE COMMAND LINE
DESCRIBE table_name; -- see the column names of the tableSHOW TABLES '\*keyword\*'; -- list all tables that contain 'keyword'SHOW PARTITIONS table_name; -- list all the partition of the tableDROPTABLEtable_name; -- erase the tableALTER TABLE table_name_old RENAME TO table_name_new; -- rename tables