Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Several Aggregate Functions in the Query | Grouping
course content

Contenido del Curso

Intermediate SQL

Several Aggregate Functions in the QuerySeveral Aggregate Functions in the Query

The school now knows the last names of those students who received more than one grade for exams, and the administration has decided to calculate the average grade from multiple grades of these students, and that will be their final grade.

You have to do this.

Here is the preview of a student_grades table we are working with:

id student_surname class_letter subject_name grade
1 Smith A Mathematics 85
2 Johnson B Physics 90
3 Williams C Chemistry 78
4 Brown A Biology 92
... ... ... ... ...
100 Gonzales A Biology 89

Tarea

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.

¿Todo estuvo claro?

Sección 1. Capítulo 7
toggle bottom row
course content

Contenido del Curso

Intermediate SQL

Several Aggregate Functions in the QuerySeveral Aggregate Functions in the Query

The school now knows the last names of those students who received more than one grade for exams, and the administration has decided to calculate the average grade from multiple grades of these students, and that will be their final grade.

You have to do this.

Here is the preview of a student_grades table we are working with:

id student_surname class_letter subject_name grade
1 Smith A Mathematics 85
2 Johnson B Physics 90
3 Williams C Chemistry 78
4 Brown A Biology 92
... ... ... ... ...
100 Gonzales A Biology 89

Tarea

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.

¿Todo estuvo claro?

Sección 1. Capítulo 7
toggle bottom row
some-alt