通过sql语句分析足彩(r2笔记55天)

时间:2022-05-04
本文章向大家介绍通过sql语句分析足彩(r2笔记55天),主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

老是做工作中的数据分析,最近也在看足球彩票,竞猜游戏有输有赢,但是里面还是有不少的数据分析的乐趣,关于足球彩票的分析,自己写了如下的程序,可以参考。当然了,最好能带有主观的分析,这样可能准确率要高一些。 以下是仅根据赔率做的一个分析。 比如我们目前计划投资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 <<EOF 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<=((2*$win_point*$win_point*$tie_point*$tie_point*$lose_point*$lose_point)/($win_point*$tie_point+$win_point*$lose_point +$tie_point*$lose_point-$win_point *$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<500; 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 最后说明这个仅供参考。分析还有不足和错误的地方,谅解谅解。