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
|
-- Tables Section
-- _____________
create table TacheService (
TacheServiceId int not null,
constraint Tache_PK primary key (TacheServiceId));
create table Etude (
EtudeId int not null,
constraint Etude_PK primary key (EtudeId));
create table SousEtude (
EtudeId int not null,
SousEtudeId int not null,
constraint SousEtude_PK primary key (EtudeId, SousEtudeId));
create table ETS (
EtudeId int not null,
TacheServiceId int not null,
constraint ETS_PK primary key (EtudeId, TacheServiceId));
create table SETS (
EtudeId int not null,
SousEtudeId int not null,
TacheServiceId int not null,
constraint SETS_PK primary key (EtudeId, SousEtudeId, TacheServiceId));
-- Constraints Section
-- ___________________
alter table SousEtude add constraint SousEtude_Etude_FK
foreign key (EtudeId)
references Etude (EtudeId);
alter table ETS add constraint ETS_Etude_FK
foreign key (EtudeId)
references Etude (EtudeId);
alter table ETS add constraint ETS_TacheService_FK
foreign key (TacheServiceId)
references TacheService (TacheServiceId);
alter table SETS add constraint SETS_SousEtude_FK
foreign key (EtudeId, SousEtudeId)
references SousEtude (EtudeId, SousEtudeId);
alter table SETS add constraint SETS_TacheService_FK
foreign key (TacheServiceId)
references TacheService (TacheServiceId); |
Partager