Several 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.
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_surnamecolumn and the average of thegradecolumn using theAVGfunction. - Assign the alias
average_gradeto the second column. - Group the data by
student_surname. - Use the
HAVINGclause to filter the results based onCOUNT(grade) > 1. - Sort the results by
student_surname.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4
Several Aggregate Functions in the Query
Swipe to show menu
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.
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_surnamecolumn and the average of thegradecolumn using theAVGfunction. - Assign the alias
average_gradeto the second column. - Group the data by
student_surname. - Use the
HAVINGclause to filter the results based onCOUNT(grade) > 1. - Sort the results by
student_surname.
Solution
Thanks for your feedback!
single