4
I have the following table:
CREATE TABLE ALUNO (
RA NUMBER(9),
DISCIPLINA VARCHAR2(30),
MEDIA NUMBER(3,1),
CARGA_HORA NUMBER(2),
FALTAS NUMBER(2),
RESULTADO VARCHAR2(10)
);
And the following data:
INSERT INTO ALUNO VALUES (1,'SQL',7.5,80,20,'');
INSERT INTO ALUNO VALUES (2,'PLSQL',5.5,80,20,'');
INSERT INTO ALUNO VALUES (3,'MBD',7.5,80,40,'');
I have the following sql:
select ra,
Disciplina,
Media,
Carga_Hora,
Faltas,
case when (Media >= 7) and (trunc((Faltas / Carga_Hora * 100)) <= 25) then 'APROVADO'
when (Media between 5 and 6.9) and (trunc((Faltas / Carga_Hora * 100)) <= 25) then 'EXAME'
else 'REPROVADO' end Resultado
from student order by ra
I need to create a block to fill the result field:
- If the student had an average equal to or greater than or equal to 7.0 and his absences did not exceed 25% of the course workload the result will be:
APROVADO
. - If the student got an average of less than 7.0 and his absences do not exceed 25% of the course workload the result will be:
EXAME
. - For other cases the result will be:
REPROVADO
.
I tried to adjust your question to be more readable. If there is something wrong, do not hesitate to edit it.
– utluiz