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;
$$

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.
– anonimo
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
– user211220
GROUP BY Nota.codAluno) 2) If you want the lowest average, you need to do MIN (MIN(AVG(Nota.nota))– Ricardo Pontual
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.– anonimo