I have a database of students of a university in which each form corresponds to a particular subject. The DER (Relationship Entity Diagram) is the following:
and I have problems with the following statements to solve:
1) Show the student with the highest grade in each evaluative instance
select Tipo.Nombre [Instancia], MAX(Evaluacion.Nota) [Nota más alta]
from Evaluacion
inner join Tipo on Tipo.IDTipo = Evaluacion.IDTipo
group by Tipo.Nombre
order by Tipo.Nombre
With this query I show the highest mark of each evaluative instance, but I do not know in which way to show the name of the student.
2) Show the average of disapproved in each instance.
I know that in both you should use subconsulta
but I do not know how to implement it since we still do not work with it. Thank you in advance for your help. Greetings