Help with a lower grade grade grade grade

Asked

Viewed 24 times

0

Create a program that lists the discipline with the lowest grade point average. I can’t pull and the lowest grade point average and I hit a lock. I made this code so far. I really appreciate the help from friends

DROP PROCEDURE if EXISTS pListaMenorMedia;
delimiter
CREATE PROCEDURE pListaMenorMedia
begin
select d.Nomesciplina, avg(N.nota) as mediaNota from Disciplina d
join Nota n on d.CodDisciplina = n.codDisciplina
where 
end;
$$

inserir a descrição da imagem aqui

  • Create a subselect that lists all subjects with average grades (AVG(Nota.nota) / GROUP BY Disciplina.codDisciplina) and a select that selects the lowest average and your discipline (MIN(média_das_notas)) from the previous subselect.

  • was what I was thinking of doing. But I still have doubts on how to do this subselect. I’ll keep searching, thanks for the help friend

    1. if you want the averages per student need to group per student (GROUP BY Nota.codAluno) 2) If you want the lowest average, you need to do MIN (MIN(AVG(Nota.nota))
  • Testing SELECT foo.nomeDisciplina, MIN(foo.media) FROM (SELECT d.nomeDisciplina, AVG(n.nota) AS media FROM Disciplina d INNER JOIN Nota n ON (d.codDisciplina = n.codDisciplina) GROUP BY d.nomeDisciplina) foo.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.