create-lotto.sql 927 Bytes
Newer Older
M1888's avatar
M1888 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TABLE IF NOT EXISTS Scoreboard (
    Nimi VARCHAR(255),
    Saldo INT,
    Pvm DATETIME
);

CREATE TABLE IF NOT EXISTS Lottorivit (
    id INT NOT NULL PRIMARY KEY,
    n1 INT DEFAULT 1,
    n2 INT DEFAULT 2,
    n3 INT DEFAULT 3,
    n4 INT DEFAULT 4,
    n5 INT DEFAULT 5,
    n6 INT DEFAULT 6,
    n7 INT DEFAULT 7
);

M1888's avatar
M1888 committed
18
-- Luodaan vakiorivit
M1888's avatar
sql    
M1888 committed
19
20
21
22
23
24
25
26
INSERT INTO Lottorivit (id, n1, n2, n3, n4, n5, n6, n7) VALUES
-- Suomen yleisin lottorivi on 3 9 15 21 27 33 39 
	(1, 3, 9, 15, 21, 27, 33, 39),
	(2, 1, 2, 3, 4, 5, 6, 7),
	(3, 5, 10, 15, 20, 25, 30),
	(4, 10, 15, 20, 25, 30, 35),
	(5, 15, 20, 25, 30, 35, 40);
-- loput saa pelaaja npytell itse
M1888's avatar
M1888 committed
27
INSERT INTO Lottorivit (id) VALUES
M1888's avatar
sql    
M1888 committed
28
    (6), (7), (8), (9), (10), (11), (12), (13), (14), (15);
M1888's avatar
M1888 committed
29
30
31
32


-- Jotain dataa scoreboardillekin
INSERT INTO Scoreboard (Pvm, Nimi, Saldo) VALUES
M1888's avatar
sql    
M1888 committed
33
34
	(DATETIME(), 'Taina Testaaja', -42000000),
	(DATE('now', '-5 day'), 'Teppo Testaaja', -65625205);