134k views
5 votes
Give a listing of all the class_descriptions and the number of students enrolled in each class for all students who are older than the average age where the total number of students for the class is more than 1 student. Order by the number of students. If there is no class description replace it with 'Other Classes'?

User Arun Patra
by
8.6k points

1 Answer

5 votes

Final answer:

To list class descriptions and number of students enrolled for older students, calculate average age, filter by age, group and count students by class, and order the results.

Step-by-step explanation:

To list the class descriptions and the number of students enrolled in each class for students who are older than the average age, we need to follow these steps:

  1. Calculate the average age of all students
  2. Filter out all students who are younger than or equal to the average age
  3. Group the remaining students by class
  4. Count the number of students in each class
  5. Order the results by the number of students in each class

If a class has only one student or no class description, replace it with 'Other Classes'.