赞
踩
小区的名称 户型 面积 区域 楼层 朝向 总价 单价 建筑时间
- create table tb_sh_price(
- name STRING,
- house_type STRING,
- house_area STRING,
- region STRING,
- floor_str STRING,
- direction STRING,
- total_price STRING,
- square_price STRING,
- build_date STRING
- )
- ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
- LINES TERMINATED BY '\n';
LOAD DATA LOCAL INPATH '/opt/datas/2nd_house_price.csv' INTO TABLE tb_sh_price;
面积:统计各个房面积 所在房数
50㎡以下 50-70㎡ 70-90㎡ 90-110㎡ 110-140㎡
- select
- t.area_grop,count(house_area) as total
- from
- (
- select
- house_area,
- case
- when 0< house_area and house_area<=50 then "50平以下"
- when 50< house_area and house_area<=70 then "50-70平"
- when 70< house_area and house_area<=90 then "70-90平"
- when 90< house_area and house_area<=110 then "90-110平"
- when 110< house_area and house_area<=140 then "110-140平"
- else "140平+"
- end as area_grop
- from
- db_lianjia.tb_sh_price
- ) t
- group by
- t.area_grop;
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- t.area_grop total
- 110-140平 4190
- 140平+ 3701
- 50-70平 5775
- 50平以下 4291
- 70-90平 5739
- 90-110平 4505
楼龄(1992年建)
5年以内 10年以内 15年以内 20年以内
- select
- t.year_grop,count(build_date) as total
- from
- (
- select
- tb_sh_price.build_date,
- case
- when (2019-substring(build_date,0,4)) between 0 and 5 then "5年以内"
- when (2019-substring(build_date,0,4)) between 5 and 10 then "10年以内"
- when (2019-substring(build_date,0,4)) between 10 and 15 then "15年以内"
- when (2019-substring(build_date,0,4)) between 15 and 20 then "20年以内"
- else "20年以上"
- end as year_grop
- from
- tb_sh_price
- where
- length(trim(build_date))>0
- ) as t
- group by
- t.year_grop;
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- create table tb_sh_group
- ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
- STORED AS TEXTFILE
- as
- select
- t.year_grop,count(build_date) as total
- from
- (
- select
- tb_sh_price.build_date,
- case
- when (2019-substring(build_date,0,4)) between 0 and 5 then "5年以内"
- when (2019-substring(build_date,0,4)) between 5 and 10 then "10年以内"
- when (2019-substring(build_date,0,4)) between 10 and 15 then "15年以内"
- when (2019-substring(build_date,0,4)) between 15 and 20 then "20年以内"
- else "20年以上"
- end as year_grop
- from
- tb_sh_price
- where
- length(trim(build_date))>0
- ) as t
- group by
- t.year_grop;
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- 梅园六街坊,2室0厅,47.72,浦东,低区/6层,朝南,500,104777,1992年建
- 碧云新天地(一期),3室2厅,108.93,浦东,低区/6层,朝南,735,67474,2002年建
- 博山小区,1室1厅,43.79,浦东,中区/6层,朝南,260,59374,1988年建
- 金桥新村四街坊(博兴路986弄),1室1厅,41.66,浦东,中区/6层,朝南北,280,67210,1997年建
- 博山小区,1室0厅,39.77,浦东,高区/6层,朝南,235,59089,1987年建
- 潍坊三村,1室0厅,34.84,浦东,中区/5层,,260,74626,1983年建
- 伟莱家园,2室2厅,100.15,浦东,中区/6层,朝南北,515,51422,2002年建
- 世茂滨江花园,3室2厅,260.39,浦东,中区/51层,朝西,2200,84488,
- 羽北小区,2室2厅,69.88,浦东,低区/6层,朝南,560,80137,1994年建
- 证大家园(公寓),3室2厅,122.75,浦东,低区/11层,朝南北,785,63951,2002年建
- 上南十村,1室1厅,40.17,浦东,低区/6层,朝南,240,59746,1992年建
- 鹏欣家园,1室1厅,59.42,浦东,中区/6层,朝南,410,69000,1998年建
- 香楠小区,2室2厅,80.34,浦东,高区/6层,,420,52277,
- 恒大华城新华苑,2室1厅,68.9,浦东,高区/6层,朝南北,460,66763,1997年建
- 金橘新苑,1室1厅,61.65,浦东,低区/18层,朝南,370,60016,2006年建
- 陆家嘴花园(一期),3室2厅,156.45,浦东,中区/11层,朝南北,1400,89485,1999年建
- 齐七小区,2室1厅,67.49,浦东,低区/6层,朝南,415,61490,1997年建
- 碧云新天地(一期),3室2厅,129.82,浦东,中区/6层,朝南北,910,70097,2002年建
- 芳华路713弄,2室1厅,65.55,浦东,高区/6层,朝南北,365,55682,1995年建
- 环球翡翠湾花园(公寓),3室2厅,118.86,浦东,中区/18层,朝南北,720,60575,2006年建
- 香楠小区,2室2厅,85.83,浦东,高区/6层,朝南北,440,51264,
- 连波路228弄,3室1厅,72.85,浦东,低区/6层,朝南,430,59025,1996年建
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。