通过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

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

目录
相关文章
|
3月前
|
SQL 存储 缓存
四、SQL语句执行过程分析
四、SQL语句执行过程分析
34 0
|
15天前
|
SQL 数据库 索引
SQL索引失效原因分析与解决方案
SQL索引失效原因分析与解决方案
22 0
|
23天前
|
SQL 关系型数据库 MySQL
【MySQL】慢SQL分析流程
【4月更文挑战第1天】【MySQL】慢SQL分析流程
|
2月前
|
SQL 关系型数据库 MySQL
10个SQL中常用的分析技巧
10个SQL中常用的分析技巧
|
2月前
|
SQL 存储 关系型数据库
MySQL(终结篇二)- SQL 语句分析与优化
MySQL(终结篇二)- SQL 语句分析与优化
87 0
|
3月前
|
SQL
leetcode-SQL-550. 游戏玩法分析 IV
leetcode-SQL-550. 游戏玩法分析 IV
22 1
|
3月前
|
SQL
leetcode-SQL-1084. 销售分析III
leetcode-SQL-1084. 销售分析III
30 0
|
3月前
|
SQL
leetcode-SQL-1158. 市场分析 I
leetcode-SQL-1158. 市场分析 I
19 1
|
3月前
|
SQL
leetcode-SQL-511. 游戏玩法分析 I
leetcode-SQL-511. 游戏玩法分析 I
22 0
|
3月前
|
SQL 数据挖掘 数据处理
「SQL面试题库」 No_71 市场分析 II
「SQL面试题库」 No_71 市场分析 II