Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Декілька агрегативних функцій у запиті | Групування
Розширений Рівень SQL
course content

Зміст курсу

Розширений Рівень SQL

Розширений Рівень SQL

1. Групування
2. Вкладені Запити
3. Об'єднання Таблиць
4. DDL та DML в SQL

book
Декілька агрегативних функцій у запиті

Школа тепер знає прізвища студентів, які отримали більше однієї оцінки за іспити, і адміністрація вирішила обчислити середній бал з декількох оцінок цих студентів, і це буде їхнім остаточним балом.

Вам потрібно це зробити.

Ось попередній перегляд таблиці student_grades, з якою ми працюємо:

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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

book
Декілька агрегативних функцій у запиті

Школа тепер знає прізвища студентів, які отримали більше однієї оцінки за іспити, і адміністрація вирішила обчислити середній бал з декількох оцінок цих студентів, і це буде їхнім остаточним балом.

Вам потрібно це зробити.

Ось попередній перегляд таблиці student_grades, з якою ми працюємо:

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 7
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt