create table etud_mod (
matricule char(9),
cod_mod char(6),
an_sco char (9),
note1 number(4,2) DEFAULT 0,
note2 number(4,2) DEFAULT 0,
note_syn number(4,2) ,
note_rat number(4,2),
note_tp number(4,2),
constraint mat_cod_pk primary key(matricule,cod_mod,an_sco),
foreign key (matricule,an_sco) references etud_sect(matricule,an_sco),
foreign key (cod_mod) references fil_mod(cod_mod),
constraint not_min_max check
(
note1 between 0 and 20 AND
note2 between 0 and 20 AND
note_rat between 0 and 20 AND
note_tp between 0 and 20 AND
(
note_syn is NULL OR
(10 > GREATEST((note1+note2+note_tp)/3 , (note_syn+note_tp)/2)
AND
cod_mod in (select cod_mod from module where atp = 'o')
) OR
(10 > GREATEST( (note1+note2)/2 , note_syn )
AND
cod_mod in (select cod_mod from module where atp = 'n')
)
)
),
);
Partager