Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Average Student's Grade Challenge | Grouping
course content

Зміст курсу

Intermediate SQL

Average Student's Grade ChallengeAverage Student's Grade Challenge

You've done an excellent job and helped the construction company. They have started working on expanding the Yellow metro line.

They have recommended you, and the school has shown interest in you because they also have several tasks for you. But first, let's familiarize ourselves with the table they provide:

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

As you can see, the school has a total of 100 students, information about whom is provided in the given table. There is information in the class_letter column, which has 3 options: A, B, or C. The subject name(subject_name), as well as the student's grade(grade), are included. The table is simple and contains grades for exams in various subjects.

Let's see how many students there are in each class with the following query:

However, the school has given us a task to calculate the average grade for all subjects for each student. This is what you need to do in this chapter.

Завдання

Your task now is to calculate the average grade for all subjects for each student. Also, for the convenience of the teachers, you need to sort the students' last names in alphabetical order. Use aggregation with the AVG() function and give an alias average_rate to ensure successful testing.

Все було зрозуміло?

Секція 1. Розділ 4
toggle bottom row
course content

Зміст курсу

Intermediate SQL

Average Student's Grade ChallengeAverage Student's Grade Challenge

You've done an excellent job and helped the construction company. They have started working on expanding the Yellow metro line.

They have recommended you, and the school has shown interest in you because they also have several tasks for you. But first, let's familiarize ourselves with the table they provide:

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

As you can see, the school has a total of 100 students, information about whom is provided in the given table. There is information in the class_letter column, which has 3 options: A, B, or C. The subject name(subject_name), as well as the student's grade(grade), are included. The table is simple and contains grades for exams in various subjects.

Let's see how many students there are in each class with the following query:

However, the school has given us a task to calculate the average grade for all subjects for each student. This is what you need to do in this chapter.

Завдання

Your task now is to calculate the average grade for all subjects for each student. Also, for the convenience of the teachers, you need to sort the students' last names in alphabetical order. Use aggregation with the AVG() function and give an alias average_rate to ensure successful testing.

Все було зрозуміло?

Секція 1. Розділ 4
toggle bottom row
some-alt