informatique clé primaire

591 mots 3 pages
2.1) En premier il faut créer les tables TRIATHLETE et PISCINE car elles n’ont pas de clés etrangéres. Après il faudra créer la table ENTRAINEMENT car ont en a besoin pour créer la table PLAN_ENTRAINEMENT. Ensuite il faudra créer la table PLAN_ENTRAINEMENT qui a besoin de la table ENTRAINEMENT et TRIATHLETE.

CREATE TABLE TRIATHLETE ( NumLicence int NOT NULL AUTO_INCREMENT, NomAthlete varchar (50) NOT NULL, PrenomAthlete varchar (50) NOT NULL, CategorieAthlete varchar (50) NULL, PRIMARY KEY (NumLicence) ) ;

CREATE TABLE PISCINE (
NumPiscine int NOT NULL AUTO_INCREMENT,
NomPiscine varchar (50) NOT NULL,
AdressePiscine varchar (100) NOT NULL,
PRIMARY KEY (NumPiscine) ) ;

CREATE ENTRAINEMENT (
NumEntrainement int NOT NULL AUTO_INCREMENT,
DateEntrainement date NULL,
HeureDebut heure NULL,
HeureFin heure NULL,
NumPiscine int NOT NULL,
PRIMARY KEY (NumEntrainement) ) ;
CREATE PLAN_ENTRAINEMENT (
NumEntrainement int NOT NULL,
NumLicence int NOT NULL,
DistanceAParcourir int NULL,
DistanceParcourue int NULL,
PRIMARY KEY (NumEntrainement, NumLicence) ) ;

ALTER TABLE ENTRAINEMENT ADD
FOREIGN KEY (NumPiscine) REFERENCES PISCINE (NumPiscine) ;

ALTER TABLE PLAN_ENTRAINEMENT ADD
FOREIGN KEY (NumEntrainement) REFERENCES ENTRAINEMENT (NumEntrainement),
FOREIGN KEY (NumLicence) REFERENCES TRIATHLETE (NumLicence) ;

2.2) SELECT DateEntrainement, HeureDebut, HeureFin, NomPiscine DistanceAParcourir, DistanceParcourue, NumLicence
FROM ENTRAINEMENT, PLAN_ENTRAINEMENT, PISCINE
WHERE ENTRAINEMENT.NumEntrainement = PLAN_ENTRAINEMENT.NumEntrainement
AND ENTRAINEMENT.NumPiscine = PISCINE.NumPiscine
AND PLAN_ENTRAINEMENT.NumLicence = 2413
AND DateEntrainement > "01/09/1999"
ORDER BY DESC DateEntrainement ;

2.3) SELECT NomAthlete, PrenomAthlete, DateEntrainement
FROM TRIATHLETE, ENTRAINEMENT, PLAN_ENTRAINEMENT, PISCINE
WHERE TRIATHLETE.NumLicence = PLAN_ENTRAINEMENT.NumLicence
AND ENTRAINEMENT.NumEntrainement =

en relation

  • Correction exo IRM
    1099 mots | 5 pages
  • Journal d un objet
    733 mots | 3 pages
  • Fichier de la danse
    782 mots | 4 pages
  • feure
    367 mots | 2 pages
  • lettre pour soutien Mme Breuil
    344 mots | 2 pages
  • David cours
    413 mots | 2 pages
  • article ludique
    549 mots | 3 pages
  • Le sprint tpe
    5714 mots | 23 pages
  • Bobz
    330 mots | 2 pages
  • Sousou
    356 mots | 2 pages
  • bolot
    6685 mots | 27 pages
  • reem
    446 mots | 2 pages
  • Situation d'APPRENTISSAGE ET D'évaluation
    8914 mots | 36 pages
  • aLea
    3815 mots | 16 pages
  • 12345
    789 mots | 4 pages