· 8 years ago · May 16, 2018, 09:16 PM
1drop database if exists tanc;
2
3create database tanc
4 DEFAULT CHARACTER SET utf8
5 DEFAULT COLLATE utf8_general_ci;
6
7use tanc;
8
9create table Tancklub(
10 id int primary key auto_increment,
11 nev nvarchar(50) not null,
12 tanctanar nvarchar(50) not null,
13 alapitasev date
14);
15
16create table Tancos(
17 id int primary key auto_increment,
18 nev nvarchar(50),
19 kategoria nvarchar(2),
20 tancpar nvarchar(50),
21 tancklubid int not null,
22 foreign key(tancklubid) references tancklub(id)
23);
24
25create table Verseny(
26 id int primary key auto_increment,
27 nev nvarchar(60),
28 Idopont date,
29 Helyszin nvarchar (100)
30);
31
32create table Resztvevo(
33 Tancosid int not null,
34 Versenyid int not null,
35 Helyezes int not null,
36 primary key(Tancosid, Versenyid),
37 foreign key(Tancosid) references Tancos(id),
38 foreign key(Versenyid) references Verseny(id)
39);
40
41insert into Tancklub(nev, tanctanar, alapitasev) values ('Dancing Queen TSE', 'Zsigovics István', '2018-01-23');
42insert into Tancklub(nev, tanctanar, alapitasev) values('EveryDance TSE', 'Szaka Krisztina', '2008-01-01');
43insert into Tancklub(nev, tanctanar, alapitasev) values('Szilver TSE', 'László Csaba', '2002-01-01');
44insert into Tancklub(nev, tanctanar, alapitasev) values('whatever', 'whatever','2011-03-02');
45insert into Tancklub(nev, tanctanar, alapitasev) values('elegem van', 'whatever','2001-03-02');
46 insert into Tancklub(nev, tanctanar, alapitasev) values('Nem tartozik tánciskolához', 'nincs','0000-00-00');
47
48insert into Tancos(nev, kategoria, tancpar, tancklubid) values('Loránt Gábor', 'D', 'Ceglédi Eszter', 2);
49insert into Tancos(nev, kategoria, tancpar, tancklubid) values('Wolf Dániel', 'D', 'Fődi Kitti', 2);
50insert into Tancos(nev, kategoria, tancpar, tancklubid) values('Fekete Balázs', 'D', 'Haraszti Zsuzsanna', 2);
51insert into Tancos(nev, kategoria, tancpar, tancklubid) values('Gépész Zoltán', 'D', 'Simon Júlia', 4);
52insert into Tancos(nev, kategoria, tancpar, tancklubid) values('Tusják Gbáor', 'E', 'Koroknai Noémi', 1);
53insert into Tancos(nev, kategoria, tancpar, tancklubid) values('már megint mi van','D','faszom', 2);
54
55insert into Verseny(nev, idopont, helyszin) values('Buda Open','2018-04-28', 'Törökbálint');
56insert into Verseny(nev, idopont, helyszin) values('Budapest Bajnokság', '2018-03-27', 'Újpest');
57insert into Verseny(nev, idopont, helyszin) values('E Országos Bajnokság', '2017-09-30', 'Mogyoród');
58
59insert into Resztvevo(tancosid, versenyid, helyezes) values(1,1,2);
60insert into Resztvevo(tancosid, versenyid, helyezes) values(1,2,3);
61insert into Resztvevo(tancosid, versenyid, helyezes) values(2,2,2);
62insert into Resztvevo(tancosid, versenyid, helyezes) values(9,2,5);