Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Várias Funções de Agregação na Consulta | Agrupamento
SQL Intermediário
course content

Conteúdo do Curso

SQL Intermediário

SQL Intermediário

1. Agrupamento
2. Subconsultas Aninhadas
3. Juntando Tabelas
4. DDL e DML em SQL

book
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:

Tarefa

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 the grade column using the AVG 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 on COUNT(grade) > 1.
  • Sort the results by student_surname.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 7
toggle bottom row

book
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:

Tarefa

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 the grade column using the AVG 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 on COUNT(grade) > 1.
  • Sort the results by student_surname.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 7
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt