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

制作一个网站怎么做的/武汉seo排名公司

制作一个网站怎么做的,武汉seo排名公司,长沙百度网络推广,wordpress密码漏洞【摘要】SQL 虽然有集合概念,但对于集合运算、特别是有序集合运算,提供的支持却很有限,经常要采用很费解的思路才能完成,计算效率也不佳。而集算器 SPL 在方面则要直观许多,可以按自然思维习惯写出运算。这里对 SQL 和…

【摘要】
SQL 虽然有集合概念,但对于集合运算、特别是有序集合运算,提供的支持却很有限,经常要采用很费解的思路才能完成,计算效率也不佳。而集算器 SPL 在方面则要直观许多,可以按自然思维习惯写出运算。这里对 SQL 和集算器 SPL 在集合运算和行号相关运算方面进行了对比,如果需要了解更多,请前往乾学院:SQL 难点解决:集合及行号!

1、  和集

示例 1:重叠部分不重复计数时求多个时间段包含的总天数

MySQL8:

with recursive t(start,end) as (select date'2010-01-07',date'2010-01-9'

union all select date'2010-01-15',date'2010-01-16'

union all select date'2010-01-07',date'2010-01-12'

union all select date'2010-01-08',date'2010-01-11'),

t1(d,end) as (select start,end from t

union all select d+1,end from t1 where d

select count(distinct d) from t1;

说明:此例先将各时间段转成时间段内所有日子对应的日期,然后再求不同日期的个数

集算器SPL:

image.png

A3: 对 A2 中的每一个时间段构造从 start 到 end 的日期序列

A4: 求 A3 中所有日期序列的和

A5: 求 A4 中不重复日期的个数

2、  差集

示例 1:列出英语人口和法语人口均超过 5% 的国家

MySQL8:

with t1(lang) as (select 'English' union all select 'French')

select name from world.country c

where not exists(select * from t1 where lang not in (select language from world.countrylanguage where percentage>=5 and countrycode=c.code));

说明:此SQL只是演示通过双重否定实现差集为空

集算器SPL:

image.png

A4: 选出[“English”,”French”]与本组语言集合的差为空的组,意思就是选出语言集合包含English和French的组

3、  交集

示例 1:列出英语人口、法语人口、西班牙语人口分别超过 0.3%、0.2%、0.1% 的国家代码

MySQL8:

with t1 as (select countrycode from world.countrylanguage where language='English' and percentage>0.3),

t2 as (select countrycode from world.countrylanguage where language='French' and percentage>0.2),

t3 as (select countrycode from world.countrylanguage where language='Spanish' and percentage>0.1)

select countrycode

from t1 join t2 using(countrycode) join t3 using(countrycode);

说明:此例只是演示如何求解多个集合的交集

集算器SPL:

image.png

A3: 按次序依次查询英语人口超0.3%、法语人口超0.2%、西班牙语超0.1%的国家代码,并转成序列

A5: A3中所有序列交集

4、  根据行号取数据

示例 1:计算招商银行 (600036) 2017 年第 3 个交易日和倒数第 3 个交易日的交易信息

MySQL8:

with t as (select *, row_number() over(order by tdate) rn from stktrade where sid='600036' and tdate between '2017-01-01' and '2017-12-31')

select tdate,open,close,volume from t where rn=3

union all

select tdate,open,close,volume from t where rn=(select max(rn)-2 from t);

集算器SPL:

image.png

A3: 第 3 条记录和倒数第 3 条记录的和集

示例2:计算招商银行(600036)最近20个交易日的平均收盘价

MySQL8:

with t as (select *, row_number() over(order by tdate desc) rn from stktrade where sid='600036')

select avg(close) avg20 from t where rn<=20;

集算器SPL:

image.png

A2: 将600036的交易记录按日期排序

A3: 取从倒数20条到末尾的所有记录

A4: 求A3中所有记录收盘价的平均值

5、  求满足条件的记录的行号

示例 1:计算招商银行 (600036)2017 年经过多少交易日收盘价达到 25 元

MySQL8:

with t as (select *, row_number() over(order by tdate) rn from stktrade where sid='600036' and tdate between '2017-01-01' and '2017-12-31')

select min(rn) from t where close>=25;

集算器SPL:

image.png

A3: 从前往后查找第 1 个收盘价达到 25 元的记录位置

示例2:计算格力电器(000651) 2017年涨幅(考虑停牌)

MySQL8:

with t as (select * from stktrade where sid='000651'),

t1(d) as (select max(tdate) from t where tdate<'2017-01-01'),

t2(d) as (select max(tdate) from t where tdate<'2018-01-01')

select s2.close/s1.close-1 rise

from (select * from t,t1 where tdate=d) s1,

(select * from t,t2 where tdate=d) s2;

集算器SPL:

image.png

A2: 数据按交易日从小到大排序

A3: 从后往前查找交易日在2017-01-01之前的最后一条记录在序列中的行号

A4: 求2016年收盘价

A5: 求2017年收盘价,其中A2.m(-1)取倒数第1条记录,即2017年最后一个交易日对应的记录

示例3:列出2017年信息发展(300469)交易量超过250万股时的交易信息及各日涨幅(考虑停牌)

MySQL8:

with t as (select *, row_number() over(order by tdate) rn

from stktrade where sid='300469' and tdate<=date '2017-12-31'),

t1 as (select * from t where tdate>=date'2017-01-01' and volume>=2500000)

select t1.tdate, t1.close, t.volume, t1.close/t.close-1 rise

from t1 join t on t1.rn=t.rn+1;

集算器SPL:

image.png

A3: 求出2017年交易量超250万股所有记录的行号

A4: 根据行号计算相应的日期、收盘价、交易量、涨幅

6、  求最大值或最小值所在记录的行号

示例 1:计算招商银行 (600036) 2017 年最早的最低价与最早的最高价间隔多少交易日

MySQL8:

with t as (select *, row_number() over(order by tdate) rn from stktrade where sid='600036' and tdate between '2017-01-01' and '2017-12-31'),

t1 as (select * from t where close=(select min(close) from t)),

t2 as (select * from t where close=(select max(close) from t))

select abs(cast(min(t1.rn) as signed)-cast(min(t2.rn) as signed)) inteval

from t1,t2;

集算器SPL:

image.png

A3: 从前往后找最大收盘价在序列中的行号

A4: 从前往后找最小收盘价在序列中的行号

示例2:计算招商银行 (600036) 2017 年最后的最低价与最后的最高价间隔多少交易日

MySQL8:

with t as (select *, row_number() over(order by tdate) rn from stktrade where sid='600036' and tdate between '2017-01-01' and '2017-12-31'),

t1 as (select * from t where close=(select min(close) from t)),

t2 as (select * from t where close=(select max(close) from t))

select abs(cast(max(t1.rn) as signed)-cast(max(t2.rn) as signed)) inteval

from t1,t2;

集算器SPL:

image.png

A3: 从后往前找最大收盘价在序列中的行号

A4: 从后往前找最小收盘价在序列中的行号

7、  有序集合间的对位计算

示例 1:求 2018 年 3 月 6 日到 8 日创业板指 (399006) 对深证成指 (399001) 的每日相对收益率

MySQL8:

with t1 as (select *,close/lag(close) over(order by tdate) rise from stktrade where sid='399006' and tdate between '2018-03-05' and '2018-03-08'),

t2 as (select *, close/lag(close) over(order by tdate) rise from stktrade where sid='399001' and tdate between '2018-03-05' and '2018-03-08')

select t1.rise-t2.rise

from t1 join t2 using(tdate)

where t1.rise is not null;

集算器SPL:

image.png

A2: 依次查询399006和399001从2018年3月5日到8日的交易数据

A4: 依次计算A2中2个序表从第2条记录到第4条记录的涨幅,也就是399006和399001从2018年3月6日到8日的每天涨幅

A5: 对位相减,即可算出每日相对收益率

http://www.lbrq.cn/news/1359379.html

相关文章:

  • 莞城网站仿做/上首页的seo关键词优化
  • 客户说做网站价格高/网游推广
  • vue做前台网站/简述seo
  • 专业的深圳网站建设公司/安卓优化神器
  • 哪个网站能在家做兼职/免费快速网站
  • 承德网站制作加盟/免费找客户软件
  • 找别人做的网站问什么域名解析后还是上线不/最新发布的最新
  • 达州网站制作/seo 优化教程
  • eclipse sdk做网站/微信做单30元一单
  • 上海 网站工作室/广州seo招聘网
  • 如何推广个人网站/广州网站优化软件
  • 建设168网站/疫情防控最新通告
  • 微商城新零售app/上海优化网站seo公司
  • 车票在线制作网站/怎么做百度推广运营
  • 政府网站建设的基本流程/关键词优化需要从哪些方面开展
  • 禅城区做网站策划/今天的三个新闻
  • 济南网站制作套餐/大连seo网站推广
  • 最专业的礼品网站案例参考/免费创建个人网页
  • 做政府门户网站建设/江苏网站seo设计
  • 北京网站建设有哪些/关键词排名优化易下拉技术
  • 做企业网站需要人维护么/前端seo主要优化哪些
  • 长春市做网站/域名权重
  • 网站建设自评报告/网络推广网站推广
  • 小白自己做网站/域名邮箱 400电话
  • 网站设置支付宝在线支付/官网百度
  • 企业官方网站地址/seo推广百度百科
  • 香港做指数的网站/贵州seo和网络推广
  • 品牌网站建设k小蝌蚪/商品推广软文写作500字
  • 新乡做网站公司电话/百度竞价排名机制
  • 贵阳专业做网站/开发定制软件公司
  • 《Node.js与 Elasticsearch的全文搜索架构解析》
  • Android UI 组件系列(十一):RecyclerView 多类型布局与数据刷新实战
  • 句子表征-文本匹配--representation-based/interactive-based
  • [GYCTF2020]FlaskApp
  • 使用 Vuepress + GitHub Pages 搭建项目文档
  • AVDTP Media Packet 报文深度解析:蓝牙音频流的幕后功臣