TT22 icon

Projet BDD

TT22 | PRO | 03/20/16 03:32:12 PM UTC | 0 ⭐ | 4027 👁️ | Never ⏰ | []
PostgreSQL |

1.45 KB

|

None

|

0 👍

/

0 👎

create table Client (
    IdClient int not null,
    Nom TEXT not null,
    Prenom TEXT not null,
    Sexe BOOLEAN not null,
    DDN DATE not null,
    Pcode int not null,
    Score int not null,
    primary key (IdClient)
);
 
create table Sport (
    IdSport int not null,
    Nom TEXT not null,
    NbMin int not null,
    NbMax int not null,
    primary key (IdSport)
);
 
create table Lieu (
    IdLieu int not null,
    intitule TEXT not null,
    PCode int not null,
    Capacite int not null,
    Sport_IdSport int not null UNIQUE,
    primary key (IdLieu),
    constraint se_pratique
        foreign key (Sport_IdSport)
            references Sport (IdSport)
);
 
create table Evenement (
    IdEv int not null,
    Niveau int not null,
    Date DATE not null,
    Client_idClient int not null UNIQUE,
    Lieu_IdLieu int not null UNIQUE,
    primary key (IdEv),
    constraint organise
        foreign key (Client_idClient)
            references Client (IdClient),
    constraint se_situe
        foreign key (Lieu_IdLieu)
            references Lieu (IdLieu)
);
 
create table Terrain (
    Surface int not null,
    Type TEXT not null,
    IdTer int not null,
    Lieu_IdLieu int not null UNIQUE,
    primary key (IdTer),
    constraint est_compose
        foreign key (Lieu_IdLieu)
            references Lieu (IdLieu)
);
 
create table participe (
    Client_idClient int not null,
    Evenement_idEv int not null UNIQUE,
    primary key (Client_idClient),
    foreign key (Client_idClient)
        references Client (IdClient),
    foreign key (Evenement_idEv)
        references Evenement (IdEv)
);

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎