1
How do I perform the function that returns the number of credits for a given course by blocking the code? As the example at the end.
TB_DISCIPLINA
COD_DISCI DESCRICAO CREDITOS TB_CURSO_COD_CURSO
---------- --------------------------- ---------- ------------------
1 REDES 6 1
2 BANCO DE DADOS 6 3
3 ALGORITMO 4 2
4 SISTEMAS OPERACIONAIS 4 3
TB_CURSO
COD_CURSO DESCRICAO
---------- --------------
1 REDES
2 ENGENHARIA
3 SISTEMAS
Function to be created
CREATE OR REPLACE FUNCTION <nome do função>
(parâmetros – variável e tipo de dado)
RETURN <tipo de dado retornado>
BEGIN
<implementação da função>
RETURN <variável>
END;;
I got it wrong or is the course-discipline relationship 1-n? Shouldn’t it be n-n?
– Ronaldo Araújo Alves
Relationship is TB_DISCIPLINA (1,n) course Tb_course (1,1). I think so becomes clearer.
– Marciano Lazari
I agree with Ronaldo.
– Motta
Your model is a little strange and that’s why they’re weirding you out. By the example you listed each course has a single discipline, it is not strange?
– anonimo
I was reviewing my model and I believe that it is correct, because there is the matricula table, where it stores the COD_ALUNO and also the COD_DISCIPLINA. I’ll print this table.
– Marciano Lazari
@Marcianolazari This does not change the fact that the course is linked to a single discipline...?
– Ronaldo Araújo Alves
@Ronaldoaraújoalves No, a course can be linked to several disciplines.
– Marciano Lazari
@Ronaldoaraújoalves I believe I have now become correct, I changed the structure of the tables, I believe they were wrong anyway! see now!
– Marciano Lazari