《二手车销售主题数据库.docx》由会员分享,可在线阅读,更多相关《二手车销售主题数据库.docx(5页珍藏版)》请在优知文库上搜索。
1、二手车销售在hive路径下:1 启动服务binive-servicemetastore&2 :启动hive:bin/hrve# 建库createdatabasedzx_escxs;曜库usedzx_escxs;# 建表1createtab1.etb_revenue.VehiCIeS(idit.vehidenamestring,incomepricestnng)rowformatde1.imitedfie1.dsterminatedbyt;# 建表2Createtab1.etb_car_ranking(idint.vehidenamestring,Satesvo1.umesstnng,Iota1
2、.amountofsa1.esstring)rowformatde1.imitedfie1.dsterminatedbyAC;# 这表3eatetab1.etb_customer_ageana1.ysis(dint,agegroupstring.numberofpeop1.estring.Puchaseproportionstring)rowformatde1.imitedfie1.dsterminatedbyt;# 建表4createtab1.etb_customer_career,ana1.ysis(dint.Custonieroccupationstring.umbeofbuyerstr
3、ing.purchaseproportionstring)rowformatde1.imitedfie1.dsterminatedby,f;# 建表5Createtab1.etb_month1.y_customer(idint.monthstring.Customerf1.ov/string)rowformatde1.imitedfie1.dsterminatedbyf:# 建表6Createtab1.etb_month1.y_profit(idint.monthstring.profitstung)rowformatde1.imitedfie1.dsterminatedby,f;# 建表7C
4、reatetab1.etb_se1.1.ing_vehides(idint.vehideamestring,Satesvo1.umestring,Se1.1.ingpncestring)rowformatde1.imitedfie1.dsterminatedbyf;#数据迁移1在sqoop目录下:binsqooimport-connectjdbc:mysq1.:/hadoop2:3306/dzx_escxs-usernameroot-passvordroot-tab1.etb_revenue_vehides-num-mappers1-hive-import-hive-databasedzx_e
5、scxs-hive-tabtetb_revenue_vehic1.es-fe1.ds-termnated-byAf-detete-target-dr#数据迁移2在sqoop目录下:bin/sqoopimport-ectjdbc:mysq1./hadoop2:3306/dzx_escxs-usenameroot-passvordroot-tab1.etb_car_ranking-num-mappers1-hive-import-hrve-databasedzx_escxs-hrve-tabetb_car_ranking-fie1.ds-termnated-byf-detete-target-di
6、r#数据迁移3在sqoop目录下:bin/sqoopimport-connectjdbc:mysq1.:/hadoop2:3306/dzx_escxs-usenameroot-passwordroot-tab1.etbCUStomeJage.ana1.ysis-num-mappers1-hive-import-hive-databasedzx_escxs-hrve-tabtetb_customef_ageana1.ysis-fe1.ds-termnated-byAC-detete-target-dr#数据迁移4在sqoop目录下:bnsqoopimport-connectjdbc:mysq1.
7、:/hadoop2:3306/dzx_escxs-usernameroot-passwordroot-tab1.etb_customer_caree_ana1.ysis-num-mappers1-hive-import-hive-databasedzx_escxs- -hive-tab1.eMcustomeccareeJanaIyS1.S- -fie1.ds-terminated-byAf-detete-target-dir- 数据迁移5在sqoop目录下bin/sqoopimport-connectjdbc:mysqk/hadoop2:3306/dzx_escxs-usernameroot-
8、passvordroot-tab1.etb_month1.y_customer-num-mappers1-hive-import-hive-databasedzx_escxs-hive-tabtetb_month1.y_customer-fe1.ds-termnated-byAf-detete-target-dr#数据迁移6在sqoop目录下:bin/sqoopimport-connectjdbc:mysq1./hadoop2:3306/dzx_escxs-usernameroot-passwordroot-tab1.etb_month1.y_profit-num-mappers1-hive-
9、import-hive-databasedzx,escxs-hwe-tab1.etb_montb1.y_profit-fie1.ds-terminated-byV-detete-target-dir#数据迁移7在sqoop目录下:bin/sqoopimport-connectjdbc:mysq1.hadoop2:3306dzx-esos-senameroot-passwordroot-tab1.etb_Se1.1.ingvehic1.es-num-mappers1-hrve-import-hive-databasedzx_escxs-hive-tabteMSeHing.vehic1.es-fie1.ds-terminated-byAf-detete-target-dr查询1se1.ectfromtb_revenue_vehides;查询2se1.ect*fromtb_car_ranking;查询3se1.ect*fromtbcustomerage_ana1.ysis;查询4se1.ect*fromtb_cUStOmeJCareeJana1.ysis:查询5se1.ectfromtb_month1.y_cu5tomer;查询6se1.ect*fromtb_month1.y_profit;查询7se1.ectfromtb_se1.1.ing_vehides: