TT22

Projet BDD

Mar 20th, 2016
5,028
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create table Client (
  2.     IdClient int not null,
  3.     Nom TEXT not null,
  4.     Prenom TEXT not null,
  5.     Sexe BOOLEAN not null,
  6.     DDN DATE not null,
  7.     Pcode int not null,
  8.     Score int not null,
  9.     primary key (IdClient)
  10. );
  11.  
  12. create table Sport (
  13.     IdSport int not null,
  14.     Nom TEXT not null,
  15.     NbMin int not null,
  16.     NbMax int not null,
  17.     primary key (IdSport)
  18. );
  19.  
  20. create table Lieu (
  21.     IdLieu int not null,
  22.     intitule TEXT not null,
  23.     PCode int not null,
  24.     Capacite int not null,
  25.     Sport_IdSport int not null UNIQUE,
  26.     primary key (IdLieu),
  27.     constraint se_pratique
  28.         foreign key (Sport_IdSport)
  29.             references Sport (IdSport)
  30. );
  31.  
  32. create table Evenement (
  33.     IdEv int not null,
  34.     Niveau int not null,
  35.     Date DATE not null,
  36.     Client_idClient int not null UNIQUE,
  37.     Lieu_IdLieu int not null UNIQUE,
  38.     primary key (IdEv),
  39.     constraint organise
  40.         foreign key (Client_idClient)
  41.             references Client (IdClient),
  42.     constraint se_situe
  43.         foreign key (Lieu_IdLieu)
  44.             references Lieu (IdLieu)
  45. );
  46.  
  47. create table Terrain (
  48.     Surface int not null,
  49.     Type TEXT not null,
  50.     IdTer int not null,
  51.     Lieu_IdLieu int not null UNIQUE,
  52.     primary key (IdTer),
  53.     constraint est_compose
  54.         foreign key (Lieu_IdLieu)
  55.             references Lieu (IdLieu)
  56. );
  57.  
  58. create table participe (
  59.     Client_idClient int not null,
  60.     Evenement_idEv int not null UNIQUE,
  61.     primary key (Client_idClient),
  62.     foreign key (Client_idClient)
  63.         references Client (IdClient),
  64.     foreign key (Evenement_idEv)
  65.         references Evenement (IdEv)
  66. );
Advertisement