双色球 (二)

2014-11-24 10:14:30 · 作者: · 浏览: 1
l,
RED4 VARCHAR2(10) not null,
RED5 VARCHAR2(10) not null,
RED6 VARCHAR2(10) not null,
BLUE1 VARCHAR2(10) not null,
DATETIME DATE
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 8
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table BALL
add constraint ID primary key (OPENID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Create/Recreate indexes
create unique index IDX_TEST on BALL (OPENID DESC)
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Create table
create table BALL
(
OPENID VARCHAR2(10) not null,
RED1 VARCHAR2(10) not null,
RED2 VARCHAR2(10) not null,
RED3 VARCHAR2(10) not null,
RED4 VARCHAR2(10) not null,
RED5 VARCHAR2(10) not null,
RED6 VARCHAR2(10) not null,
BLUE1 VARCHAR2(10) not null,
DATETIME DATE
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 8
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table BALL
add constraint ID primary key (OPENID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Create/Recreate indexes
create unique index IDX_TEST on BALL (OPENID DESC)
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
买完彩票后数据库情况:
[sql]
SQL> SELECT count(*) FROM ball;
COUNT(*)
----------
2400000
SQL> SELECT count(*) FROM ball;
COUNT(*)
----------
2400000
第二天查看中奖情况

\

从我的数据库中查询,看是否有满足中奖的条目:
[sql]
--第2013083期 05 06 12 14 19 23 09
--第2013083期 05 06 12 14 19 23 09[sql] view plaincopyprint SQL> SELECT * FROM (
2 SELECT * FROM (
3 SELECT * FROM (
4 SELECT * FROM ball WHERE blue1='9' and (red1+red2+red3+red4+red5+red6)=(05+06+12+14+19+23)
5 and (red1=6 or red2=6 or red3=6 or red4=6 or red5=6 or red6=6))
6 WHERE (red1=5 or red2=5 or red3=5 or red4=5 or red5=5 or red6=5))
7 WHERE (red1=12 or red2=12 or red3=12 or red4=12 or red5=12 or red6=12))
8 WHERE (red1=14 or red2=14 or red3=14 or red4=14 or red5=14 or red6=14);
OPENID RED1 RED2 RED3 RED4 RED5 RED6 BLUE1 DATETIME
---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----------
904191 14 22 12 20 6 5 9
2066183 5 12 14 20 22 6 9 2013/7/19 9
SQL> SELECT * FROM (
2 SELECT * FROM (
3 SELECT * FROM (
4 SELECT * FROM ball WHERE blue1='9' and (red1+red2+red3+red4+red5+red6)=(05+06+12+14+19+23)
5 and (red1=6 or red2=6 or red3=6 or red4=6 or red5=6 or red6=