通过sql语句分析足彩

简介: 老是做工作中的数据分析,最近也在看足球彩票,竞猜游戏有输有赢,但是里面还是有不少的数据分析的乐趣,关于足球彩票的分析,自己写了如下的程序,可以参考。当然了,最好能带有主观的分析,这样可能准确率要高一些。

老是做工作中的数据分析,最近也在看足球彩票,竞猜游戏有输有赢,但是里面还是有不少的数据分析的乐趣,关于足球彩票的分析,自己写了如下的程序,可以参考。当然了,最好能带有主观的分析,这样可能准确率要高一些。
以下是仅根据赔率做的一个分析。
比如我们目前计划投资100块买单场竞猜,胜平负的赔率就有很大的差别,可以考虑有赔率大的部分来弥补赔率小的部分,这样能够基本达到中和(但是话说过来,竞猜公司的计算更是精准,通过自己其他的公式和计算,数据的范围都牢牢控制在它们的制定范围内)。
可以直接运行一下的脚本,假设数据库用户是n1
win_point=$1
tie_point=$2
lose_point=$3
max_cnt=100
echo $win_point ,  $tie_point , $lose_point

sqlplus -s n1/n1 drop table win_list;
set feedback off
set serveroutput on
declare
x number;
ceil_win_amt number;
ceil_tie_amt number;
ceil_lose_amt number;
ceil_tot_amt number;
round_win_amt number;
round_tie_amt number;
round_lose_amt number;
round_tot_amt number;
begin
for x in 2..$max_cnt loop
        if (x *$tie_point*$lose_point )))
        then
          round_win_amt:=round(x/$win_point/2);
          round_tie_amt:=round(x/$tie_point/2);
          round_lose_amt:=round(x/$lose_point/2);
          round_tot_amt:=round(2*(round_win_amt+round_tie_amt+round_lose_amt)-2*(round_win_amt*$win_point+round_tie_amt*$tie_point+round_lose_amt*$lose_point)/3,2);
          ceil_win_amt:=ceil(x/$win_point/2);
          ceil_tie_amt:=ceil(x/$tie_point/2);
          ceil_lose_amt:=ceil(x/$lose_point/2);
          ceil_tot_amt:=round(2*(ceil_win_amt+ceil_tie_amt+ceil_lose_amt)-2*(ceil_win_amt*$win_point+ceil_tie_amt*$tie_point+ceil_lose_amt*$lose_point)/3,2);
          dbms_output.put_line('win:'||ceil_win_amt||' tie:'||ceil_tie_amt||' lose:'||ceil_lose_amt||'------>will get:'||ceil_tot_amt||' '||2*(ceil_win_amt+ceil_tie_amt
+ceil_lose_amt)||'---- '||(ceil_win_amt*$win_point+ceil_tie_amt*$tie_point+ceil_lose_amt*$lose_point));
--          dbms_output.put_line('win:'||round_win_amt||' tie:'||round_tie_amt||' lose:'||round_lose_amt||'------>will get:'||_tot_amt);
          insert into win_list values(x,ceil_win_amt,ceil_tie_amt,ceil_lose_amt,ceil_tot_amt,round_win_amt,round_tie_amt,round_lose_amt,round_tot_amt);
        end if;
end loop;
commit;

end;
/
set pages 53
set linesize 200
select * from(select * from win_list  where mod(amt,2)=0 order by ceil_bonus,round_bonus desc) where rownum prompt .
select *from win_list where  mod(amt,2)=0 and ceil_win>ceil_tie and ceil_win > ceil_lose and amt  between 2 and 20;
EOF

 

运行脚本 假设我们制定赔率 1.22 3.22 5.12
ksh win.sh 1.22 3.22 5.12
运行脚本后,结果如下所示,AMT代表自己的投入,不过根据赔率,有一些不太一致,可能投入的要更多一些。
       AMT   CEIL_WIN   CEIL_TIE  CEIL_LOSE CEIL_BONUS  ROUND_WIN  ROUND_TIE ROUND_LOSE ROUND_BONUS
---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----------
         2          1          1          1       -.37          1          0          0        1.19
         4          2          1          1        .81          2          1          0        2.23
         6          3          1          1          2          2          1          1         .81
        12          5          2          2       2.81          5          2          1        4.23
         8          4          2          1       3.04          3          1          1           2
        14          6          3          2       3.85          6          2          1        5.41
        10          5          2          1       4.23          4          2          1        3.04
        16          7          3          2       5.04          7          2          2        5.19
        18          8          3          2       6.23          7          3          2        5.04
        24         10          4          3       7.04         10          4          2        8.45
        22         10          4          3       7.04          9          3          2        7.41
        20          9          4          2       7.27          8          3          2        6.23
        26         11          5          3       8.08         11          4          3        8.23
        28         12          5          3       9.27         11          4          3        8.23

最后说明这个仅供参考。分析还有不足和错误的地方,谅解谅解。

目录
相关文章
|
4天前
|
SQL 索引
19. 一个SQL语句执行很慢, 如何分析
该内容介绍了如何分析执行慢的SQL语句。首先启用慢查询日志或使用命令获取慢查询的SQL。然后利用`EXPLAIN`命令分析,关注其中的`select_type`, `type`, 和 `extra`字段。`select_type`涉及子查询和联合查询的类型,`type`表示查询优化器使用的访问类型,性能从上到下递减,`extra`字段提供额外信息,如是否使用索引等。
19 0
|
4天前
|
SQL 存储 缓存
四、SQL语句执行过程分析
四、SQL语句执行过程分析
38 0
|
4天前
|
SQL 数据可视化 算法
SQL Server聚类数据挖掘信用卡客户可视化分析
SQL Server聚类数据挖掘信用卡客户可视化分析
|
4天前
|
SQL 分布式计算 数据可视化
数据分享|Python、Spark SQL、MapReduce决策树、回归对车祸发生率影响因素可视化分析
数据分享|Python、Spark SQL、MapReduce决策树、回归对车祸发生率影响因素可视化分析
|
4天前
|
SQL 机器学习/深度学习 数据采集
数据分享|SQL Server、Visual Studio、tableau对信贷风险数据ETL分析、数据立方体构建可视化
数据分享|SQL Server、Visual Studio、tableau对信贷风险数据ETL分析、数据立方体构建可视化
|
4天前
|
SQL 机器学习/深度学习 算法
SQL SERVER ANALYSIS SERVICES决策树、聚类、关联规则挖掘分析电商购物网站的用户行为数据
SQL SERVER ANALYSIS SERVICES决策树、聚类、关联规则挖掘分析电商购物网站的用户行为数据
|
4天前
|
SQL 自然语言处理 算法
NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL]
NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL]
NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL]
|
4天前
|
SQL 关系型数据库 MySQL
[第一章 web入门]SQL注入-2 题目分析与详解
[第一章 web入门]SQL注入-2 题目分析与详解
|
4天前
|
SQL 数据库
[第一章 web入门]SQL注入-1 题目分析与详解
[第一章 web入门]SQL注入-1 题目分析与详解
|
4天前
|
SQL 数据库 索引
SQL索引失效原因分析与解决方案
SQL索引失效原因分析与解决方案
33 0