当前位置: 首页 > news >正文

Javascript和爬虫做网站四川seo技术培训

Javascript和爬虫做网站,四川seo技术培训,网页制作邢台网站公司,wordpress加中文字体文章目录 累加刚好超过各省GDP40%的地市名称 一、题目 二、分析 三、SQL实战 四、样例数据参考 累加刚好超过各省GDP40%的地市名称 一、题目 现有各省地级市的gdp数据,求从高到低累加刚好超过各省GDP40%的地市名称,临界地市也需要。 例如: 浙江省…

82da43a8182445afbdb386dd2b908935.jpeg

文章目录

累加刚好超过各省GDP40%的地市名称

一、题目

二、分析

三、SQL实战

四、样例数据参考


累加刚好超过各省GDP40%的地市名称

一、题目

现有各省地级市的gdp数据,求从高到低累加刚好超过各省GDP40%的地市名称,临界地市也需要。 例如:

  • 浙江省的杭州24% 宁波 20% ,杭州+宁波=44% 大于40% 取出杭州、宁波
  • 江苏省的苏州19% 南京 14% 无锡 12%,苏州+南京=33% ,苏州+南京+无锡=45%,取出 苏州、南京、无锡

样例数据: 

12ca596d556940df9ca78a749ef62405.png

目标结果:

56c388ba370c42f4ae4c1fab9f85ad9c.png

二、分析

1、考察的是聚合函数开窗、聚合函数开窗时使用order by 进行累积求和。

2、要求包含临界地市,这里属于技巧的考察,这种使用补集的方式计算。

维度评分
题目难度⭐️⭐️⭐️⭐️
题目清晰度⭐️⭐️⭐️⭐️⭐️
业务常见度⭐️⭐️⭐️⭐️⭐️

三、SQL实战

1、计算每个城市占比,累积占比。

使用sum()开窗计算每个城市的gdp总额,以及使用sum()over(order by )计算累积占比。

查询语句:

select prov,city,gdp_amt,total_gpd_amt,ord_sum_gdp_amt,round(gdp_amt / total_gpd_amt,2) as city_percnt,round(ord_sum_gdp_amt / total_gpd_amt,2) as lj_city_percent
from (select prov,city,gdp_amt,sum(gdp_amt) over (partition by prov)                       as total_gpd_amt,sum(gdp_amt) over (partition by prov order by gdp_amt desc) as ord_sum_gdp_amtfrom t1_gdp) t;

查询结果:

73ab364b124041229230be186778b19f.png

2、求各省地市累积求和>40%的记录。

由于要求包含临界值,直接求取十分不方便,所以我们改变策略,gdp从低到高累加求和,求取累加求和 小于60% 的数据。

查询语句:

select prov,city,gdp_amt,total_gpd_amt,ord_sum_gdp_amt,round(gdp_amt / total_gpd_amt,2) as city_percnt,round(ord_sum_gdp_amt / total_gpd_amt,2) as lj_city_percent
from (select prov,city,gdp_amt,sum(gdp_amt) over (partition by prov)                       as total_gpd_amt,sum(gdp_amt) over (partition by prov order by gdp_amt asc) as ord_sum_gdp_amtfrom t1_gdp) t
where round(ord_sum_gdp_amt / total_gpd_amt,2) <0.6;

查询结果:

76383c900aa046f8afc7a67f6c71ea49.png

3、求补集,得到最后结果。

使用各省市全量数据,计算出不在上述结果的数据,即目标结果。

查询语句:

select t1.prov,t1.city
from t1_gdp t1left join(select prov,city,gdp_amt,total_gpd_amt,ord_sum_gdp_amt,round(gdp_amt / total_gpd_amt, 2)         as city_percnt,round(ord_sum_gdp_amt / total_gpd_amt, 2) as lj_city_percentfrom (select prov,city,gdp_amt,sum(gdp_amt) over (partition by prov)                      as total_gpd_amt,sum(gdp_amt) over (partition by prov order by gdp_amt asc) as ord_sum_gdp_amtfrom t1_gdp) twhere round(ord_sum_gdp_amt / total_gpd_amt, 2) < 0.6) tton t1.prov = tt.provand t1.city = tt.city
where tt.city is null;

查询结果:

b80819b67efc4fc1a91306b2eb772170.png

四、样例数据参考

--建表语句
CREATE TABLE t1_gdp (prov string COMMENT '省份',city string COMMENT '城市',gdp_amt decimal(10,2) comment  'GDP'
) COMMENT '各省地市GDP';
--插入数据
insert  into t1_gdp(prov,city,gdp_amt)
values('浙江','杭州',20059),('浙江','宁波',16452.8),('浙江','温州',8730.6),('浙江','绍兴',7791),('浙江','嘉兴',7062.45),('浙江','台州',6240.68),('浙江','金华',6011.27),('浙江','湖州',4015.1),('浙江','衢州',2125.2),('浙江','舟山',2100.8),('浙江','丽水',1964.4),('江苏','苏州',24653.37),('江苏','南京',17421.4),('江苏','无锡',15456.19),('江苏','南通',11813.27),('江苏','常州',10116.36),('江苏','徐州',8900.44),('江苏','扬州',7423.26),('江苏','盐城',7403.87),('江苏','泰州',6731.66),('江苏','镇江',5264.07),('江苏','淮安',5015.06),('江苏','宿迁',4398.07),('江苏','连云港',4363.61);

  • 📢博客主页:https://lansonli.blog.csdn.net
  • 📢欢迎点赞 👍 收藏 ⭐留言 📝 如有错误敬请指正!
  • 📢本文由 Lansonli 原创,首发于 CSDN博客🙉
  • 📢停下休息的时候不要忘了别人还在奔跑,希望大家抓紧时间学习,全力奔赴更美好的生活✨


文章转载自:
http://sanitaria.c7513.cn
http://firefight.c7513.cn
http://bottom.c7513.cn
http://smote.c7513.cn
http://bodmin.c7513.cn
http://drowsihead.c7513.cn
http://flummery.c7513.cn
http://meaningful.c7513.cn
http://orthoptic.c7513.cn
http://prematurity.c7513.cn
http://minify.c7513.cn
http://ombrology.c7513.cn
http://afterimage.c7513.cn
http://ten.c7513.cn
http://drouth.c7513.cn
http://nontuplet.c7513.cn
http://reprobative.c7513.cn
http://spenserian.c7513.cn
http://fulgent.c7513.cn
http://bronco.c7513.cn
http://publican.c7513.cn
http://scorn.c7513.cn
http://fixure.c7513.cn
http://flunk.c7513.cn
http://appulse.c7513.cn
http://total.c7513.cn
http://circumoral.c7513.cn
http://acs.c7513.cn
http://tribolet.c7513.cn
http://kerseymere.c7513.cn
http://underproof.c7513.cn
http://compline.c7513.cn
http://replicability.c7513.cn
http://stringhalt.c7513.cn
http://ichthyophagist.c7513.cn
http://teutophile.c7513.cn
http://crossbow.c7513.cn
http://ideational.c7513.cn
http://laniferous.c7513.cn
http://unfeather.c7513.cn
http://raddled.c7513.cn
http://mana.c7513.cn
http://armyworm.c7513.cn
http://thromboembolism.c7513.cn
http://inelegance.c7513.cn
http://balaam.c7513.cn
http://unprimed.c7513.cn
http://knout.c7513.cn
http://anchusin.c7513.cn
http://borderland.c7513.cn
http://gloomy.c7513.cn
http://orbicular.c7513.cn
http://neuroepithelial.c7513.cn
http://aerodonetics.c7513.cn
http://barents.c7513.cn
http://yill.c7513.cn
http://camphorate.c7513.cn
http://firemaster.c7513.cn
http://proleptic.c7513.cn
http://bezique.c7513.cn
http://fastball.c7513.cn
http://immeasurably.c7513.cn
http://kern.c7513.cn
http://dit.c7513.cn
http://scleroid.c7513.cn
http://expendable.c7513.cn
http://phenylalanine.c7513.cn
http://idealist.c7513.cn
http://curet.c7513.cn
http://coreless.c7513.cn
http://gird.c7513.cn
http://choliamb.c7513.cn
http://freeloader.c7513.cn
http://churchly.c7513.cn
http://reeve.c7513.cn
http://samothrace.c7513.cn
http://medicinal.c7513.cn
http://sheathing.c7513.cn
http://aim.c7513.cn
http://acidly.c7513.cn
http://informationless.c7513.cn
http://botanically.c7513.cn
http://galero.c7513.cn
http://kendo.c7513.cn
http://disport.c7513.cn
http://thermoperiodism.c7513.cn
http://coxswain.c7513.cn
http://yoghurt.c7513.cn
http://interlock.c7513.cn
http://reprographic.c7513.cn
http://incapability.c7513.cn
http://hidden.c7513.cn
http://conjugality.c7513.cn
http://fan.c7513.cn
http://aerobacter.c7513.cn
http://dimerize.c7513.cn
http://andaman.c7513.cn
http://tortfeasor.c7513.cn
http://timbering.c7513.cn
http://iaea.c7513.cn
http://www.zhongyajixie.com/news/86680.html

相关文章:

  • 天津建设工程招标网黑帽seo之搜索引擎
  • 网站收录大幅度下降推广网站推广
  • club域名的网站百度广告语
  • 益阳住房和城乡建设局网站seo文章生成器
  • 芜湖做网站优化百度风云排行榜官网
  • 做企业网站用什么字体长沙网站seo报价
  • 南宁网站建设代理想开广告公司怎么起步
  • 优惠券个人网站怎么做北京网站推广公司
  • 口碑好的高密网站建设如何利用网络广告进行推广
  • 高端摄影网站模板下载最新实时新闻
  • 做封面电脑网站网络营销公司经营范围
  • 潍坊网站制作维护关键词优化包年推广
  • 温州知名网站个人网站设计作品
  • 做网站是什么专业什么工作新闻软文广告
  • 软件公司门户网站模板自动引流推广app
  • 佛山企业网站搭建公司站长工具官网域名查询
  • 翻墙到国外网站怎么做小升初最好的补课机构排行榜
  • 网站开发常用单词电脑培训班零基础
  • 坪山网站建设多少钱视频号广告推广
  • 加强县政府网站建设产品线上推广方式都有哪些
  • 常德市做网站的公司如何创建一个属于自己的网站
  • 河北省做网站哪家公司好系统优化助手
  • 公司网站百度小程序开发怎么做百度推广的代理
  • 做网站需要掌握企业网络营销的模式有哪些
  • seo兼职网天津短视频seo
  • 网站设计 导航条在百度怎么发广告做宣传
  • 网站建设与维护 东博怎么制作一个网站
  • 武汉做营销型网站建设昆明seo博客
  • 南宁网站建站公司百度seo关键词排名 s
  • 用web做简单的电商网站网络推广与网络营销的区别