Citation :
CREATE TABLE equipement
(id_equipement INT NOT NULL,
INDEX(id),
libelle_equipement VARCHAR(50),
marque VARCHAR(50),
taille VARCHAR(2),
commentaire VARCHAR(500),
PRIMARY KEY(id_equipement)
)TYPE=INNODB;
CREATE TABLE sport
(id_sport INT NOT NULL,
INDEX(id),
libelle_sport VARCHAR(50),
PRIMARY KEY(id_sport)
)TYPE=INNODB;
CREATE TABLE terrain
(id_terrain INT NOT NULL,
INDEX(id),
type_terrain VARCHAR(50),
PRIMARY KEY(id_terrain)
)TYPE=INNODB;
CREATE TABLE infos_generales
(id_info INT NOT NULL,
date DATE,
lieu VARCHAR(50)
meteo VARCHAR(50)
fk_sport INT NOT NULL,
INDEX(fk_sport),
PRIMARY KEY(id_info),
FOREIGN KEY(fk_sport) REFERENCES sport(id_sport) ON DELETE CASCADE
fk_terrain INT NOT NULL,
INDEX(fk_terrain),
FOREIGN KEY(fk_terrain) REFERENCES terrain(id_terrain) ON DELETE CASCADE)
TYPE=INNODB;
CREATE TABLE entrainement
(id_fk_info INT NOT NULL,
type_entrainement VARCHAR(50),
PRIMARY KEY(id_fk_info),
FOREIGN KEY(id_fk_info) REFERENCES infos_generales(id_info) ON DELETE CASCADE)
)TYPE=INNODB;
CREATE TABLE competition
(id_fk_info INT NOT NULL,
categorie VARCHAR(50),
nom_organisation VARCHAR(50),
classement VARCHAR(10),
PRIMARY KEY(id_fk_info),
FOREIGN KEY(id_fk_info) REFERENCES infos_generales(id_info) ON DELETE CASCADE)
)TYPE=INNODB;
CREATE TABLE resultat
(id_resultat INT NOT NULL,
chrono VARCHAR(50),
distance VARCHAR(50),
PRIMARY KEY(id_fk_info),
PRIMARY KEY(id_resultat),
)TYPE=INNODB;
|