-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddl.sql
47 lines (37 loc) · 1.74 KB
/
ddl.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
create schema amigosecreto;
use amigosecreto;
create table participante (
id int(11) not null primary key auto_increment,
nome varchar(200) not null,
email varchar(200) not null
);
create table sorteio (
id int(11) not null primary key auto_increment,
nome varchar(200) not null
);
create table sorteio_participante (
id int(11) not null primary key auto_increment,
id_participante int(11) not null,
id_sorteio int(11) not null
);
create table sorteio_participante_resultado
(
id int auto_increment
primary key,
id_sorteio int not null,
id_participante_de int not null,
id_participante_para int not null
);
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (1, 'Marcio', '[email protected]');
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (2, 'ERica', '[email protected]');
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (3, 'Diogo', '[email protected]');
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (4, 'Karine', '[email protected]');
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (5, 'Valeria', '[email protected]');
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (6, 'Roger', '[email protected]');
INSERT INTO amigosecreto.participante (id, nome, email) VALUES (7, 'Alan', '[email protected]');
INSERT INTO amigosecreto.sorteio (id, nome) VALUES (1, 'Marcio');
INSERT INTO amigosecreto.sorteio (id, nome) VALUES (2, 'fdsfdsfds');
INSERT INTO amigosecreto.sorteio (id, nome) VALUES (3, 'dsadsadas');
INSERT INTO amigosecreto.sorteio (id, nome) VALUES (4, 'dsadsadsa');
insert into sorteio_participante (id_participante, id_sorteio)
select participante.id, sorteio.id from participante, sorteio