-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateDatabase.sql
133 lines (118 loc) · 3.02 KB
/
createDatabase.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
drop database DKTDatabase;
create database DKTDatabase;
use DKTDatabase;
create table staff(
DNI varchar(9) primary key,
user varchar(20) not null,
password varchar(20) not null,
userType enum("Administrator", "Editor") not null
);
create table usergroup(
DNI varchar(9) primary key,
userName varchar(40) not null,
userSurname varchar(40) not null,
password char(20) not null,
dateBirth date not null,
address varchar(200) not null,
phoneNumber int(9) not null,
email varchar(40) not null,
nameSport enum("Futbol", "Futbol Sala","Baloncesto") not null,
image varchar(200) not null
);
create table sport(
idSport int(2) primary key,
nameSport enum("Futbol", "Futbol Sala","Baloncesto") not null
);
create table playerSport(
idPlayer varchar(9),
idSport int(2) unsigned,
idChampionship int(2) unsigned,
PRIMARY KEY (`idPlayer`, `idSport`,`idChampionship`)
);
create table team(
idTeam int(4) primary key,
idSport int(2) not null,
idChampionship int(2) not null,
nameTeam varchar(40) not null,
played int(2) not null,
points int(4) not null,
won int(2) not null,
draw int(2) not null,
lost int(2) not null,
scored int(4) not null,
conceded int(4) not null,
difference int(4) not null,
image varchar(200) not null
);
create table prize(
idPrize int(4) unsigned auto_increment primary key,
idSport int(2) not null,
namePrize varchar(40) not null,
year int(4) not null,
image varchar(200) not null
);
create table championship(
idChampionship int(2) primary key,
idSport int(6) not null,
nameChampionship varchar(40) not null,
year int(4) not null
);
create table championshipPlayer{
idChampionship int(2) unsigned,
DNI varchar(9),
position varchar(20) not null,
dorsal int(2),
gamesPlayed int(2),
goals int(2),
assists int(2),
yellowCards int(2),
redCards int(2),
PRIMARY KEY (`idChampionship`, `DNI`)
}
create table sportDay(
idSportDay int(4) unsigned auto_increment primary key,
sportDay int(4) not null,
dateDay date not null,
place varchar(40) not null,
sportName enum("Futbol", "Futbol Sala","Baloncesto") not null,
firstTeam varchar(40) not null,
secondTeam varchar(40) not null,
goalsFirstTeam int(2) not null,
goalsSecondTeam int(2) not null
);
create table news(
idNew int(6) unsigned auto_increment primary key,
sportNew enum("Futbol", "Futbol Sala","Baloncesto") not null,
dateNew date not null,
timeNew time not null,
title varchar(200) not null,
content text not null,
image varchar(200) not null
);
create table payment(
idPayment int(6) unsigned auto_increment primary key,
idPerson varchar(9) not null,
months varchar(40) not null
);
create table image(
idImage int(6) unsigned auto_increment primary key,
pathImage varchar(200) not null
);
create table comments(
idComment int(6) unsigned auto_increment primary key,
idRelated int(6) not null,
topic varchar(20) not null,
nickname varchar(20) not null,
dateComment date not null,
content text not null
);
create table matches(
idMatch int(4) primaty key,
nameMatch
idChampionship
firstTeam
secondTeam
date
time
place
);