L’équipe e1 fait référence au poste p1, lequel fait référence à la prestation t1 ;
L’équipe e1 fait référence au « pré-film » f1 lequel fait référence à la prestation t2.
a) Quel que soit le chemin emprunté, à savoir via POSTE ou QUALIFICATION, chaque équipe ne peut faire référence qu’à un seul métier.
b) Quel que soit le chemin emprunté, à savoir via POSTE ou PRE_FILM, chaque équipe ne peut faire référence qu’à une seule prestation.
create table METIER (
metierId int not null,
metierNom varchar(32) not null,
constraint ID_METIER primary key (metierId));
create table PERSONNE (
personneId int not null,
personneNom varchar(32) not null,
constraint ID_PERSONNE primary key (personneId));
create table QUALIFICATION (
metierId int not null,
personneId int not null,
constraint ID_QUALIFICATION primary key (metierId, personneId));
create table PRESTATION (
prestationId int not null,
prestationNom varchar(32) not null,
dateDebut date not null,
dateFin date not null,
constraint ID_PRESTATION primary key (prestationId));
create table POSTE (
metierId int not null,
prestationId int not null,
quantite int not null,
constraint ID_POSTE primary key (prestationId, metierId));
create table FILM (
filmId int not null,
filmTitre varchar(32) not null,
constraint ID_FILM_ID primary key (filmId));
create table PRE_FILM (
filmId int not null,
prestationId int not null,
constraint ID_PRE_FILM primary key (prestationId, filmId));
create table EQUIPE (
prestationId int not null,
metierId int not null,
personneId int not null,
equipeId int not null,
filmId int not null,
periode daterange not null,
constraint ID_EQUIPE primary key (prestationId, metierId, personneId, equipeId),
constraint SID_EQUIPE unique (prestationId, metierId, personneId, periode));
alter table QUALIFICATION add constraint FKQUA_MET
foreign key (metierId)
references METIER (metierId);
alter table QUALIFICATION add constraint FKQUA_PER
foreign key (personneId)
references PERSONNE (personneId);
alter table POSTE add constraint FKPOS_PRE
foreign key (prestationId)
references PRESTATION (prestationId);
alter table POSTE add constraint FKPOS_MET
foreign key (metierId)
references METIER (metierId);
alter table PRE_FILM add constraint FKPFP
foreign key (prestationId)
references PRESTATION (prestationId);
alter table PRE_FILM add constraint FKPFF
foreign key (filmId)
references FILM (filmId);
alter table EQUIPE add constraint FKEQU_QUA
foreign key (metierId, personneId)
references QUALIFICATION (metierId, personneId);
alter table EQUIPE add constraint FKEQU_POS
foreign key (prestationId, metierId)
references POSTE (prestationId, metierId);
alter table EQUIPE add constraint FKEPF
foreign key (prestationId, filmId)
references PRE_FILM (prestationId, filmId);