Várias Funções de Agregação na Consulta
A escola agora conhece os sobrenomes dos alunos que receberam mais de uma nota em provas, e a administração decidiu calcular a média das notas desses alunos, e essa será a nota final deles.
Você precisa fazer isso.
Aqui está uma prévia da tabela student_grades
com a qual estamos trabalhando:
Swipe to start coding
You should retrieve the last names of students with more than one exam grade and also calculate the average grade from all their grades. In the response, you should have 2 columns: the first one is the student_surname
, and the second one is the average_grade
. Use AVG()
and COUNT()
aggregate functions in this task.
Also, sort the result by the student_surname
column in the ascending order.
Brief Instructions
- Retrieve the
student_surname
column and the average of thegrade
column using theAVG
function. - Assign the alias
average_grade
to the second column. - Group the data by
student_surname
. - Use the
HAVING
clause to filter the results based onCOUNT(grade) > 1
. - Sort the results by
student_surname
.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
How can I identify which students received more than one grade?
Can you show me how to calculate the average grade for these students?
What should I do if a student has only one grade?
Awesome!
Completion rate improved to 4
Várias Funções de Agregação na Consulta
Deslize para mostrar o menu
A escola agora conhece os sobrenomes dos alunos que receberam mais de uma nota em provas, e a administração decidiu calcular a média das notas desses alunos, e essa será a nota final deles.
Você precisa fazer isso.
Aqui está uma prévia da tabela student_grades
com a qual estamos trabalhando:
Swipe to start coding
You should retrieve the last names of students with more than one exam grade and also calculate the average grade from all their grades. In the response, you should have 2 columns: the first one is the student_surname
, and the second one is the average_grade
. Use AVG()
and COUNT()
aggregate functions in this task.
Also, sort the result by the student_surname
column in the ascending order.
Brief Instructions
- Retrieve the
student_surname
column and the average of thegrade
column using theAVG
function. - Assign the alias
average_grade
to the second column. - Group the data by
student_surname
. - Use the
HAVING
clause to filter the results based onCOUNT(grade) > 1
. - Sort the results by
student_surname
.
Solução
Obrigado pelo seu feedback!
Awesome!
Completion rate improved to 4single