I have the following relationships:
The statement of the exercise is:
What is the average grade of teachers assigned by course discipline Geography in the first semester of 2013. Present the name of the teacher, discipline and the average. Sort by teacher's name.
I made the following query:
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: the way my query is, it is grouping by name of teachers, and the exercise only wants you to group by discipline of the course, but how will I be able to return the names of these teachers without grouping? And instead of using INNER JOIN, are those joins with WHERE going to work?