1
I have the following relationships:
The statement of the financial year is:
The average grade given by teachers per course discipline Geography in the first half of 2013. Name teacher, discipline and media. Sort by the name of the teacher.
I made the following consultation:
SELECT Professor.nome, Disciplina.nome, AVG(Aula.nota) as Media
FROM Aluno, Disciplina, Professor, Disciplina, DisciplinaCurso, Curso
WHERE DisciplinaCurso.NumDisp = Curso.NumDisp AND
DisciplinaCurso.NumDisp = Disciplina.NumDisp AND
Aula.NumDisp = Disciplina.NumDisp AND Aula.NumFunc = Professor.NumFunc
AND Curso.Nome = 'Geografia' AND Aula.Semestre = '1º Semestre de 2013'
GROUP BY Professor.nome, Disciplina.nome
ORDER BY Professor.nome;
My question is: as my query is, she is grouping by name of teachers, and the exercise just wants me to group by course discipline, but how will I be able to return the name of these teachers without grouping? And instead of using INNER JOIN, these junctions with WHERE will work?
junctions with or with Inner Join
,
and condition in Where, give in the same, just changes the syntax. Particularly, I prefer to use Inner or left Join. I understand that your query is correct, because if asked to display the name of the teacher, the discipline and media, the group by will be by the teacher and by the discipline.– Rovann Linhalis
@Rovannlinhalis I understand man.... nice!
– William Henrique