In this MySQL challenge, your query should return the names of the people who are reported to (excluding null values), the number of members that report to them, and the average age of those members as an integer. The rows should be ordered by the names in alphabetical order. Your output should look like the following table.

ReportsTo Members Average Age
Bob Boss 2 24
Daniel Smith 1 22
David S 1 25
Jenny Richards 2 31

Main Table:

ID FirstName LastName ReportsTo Position Age
1 Daniel Smith Bob Boss Engineer 25
2 Mike White Bob Boss Contractor 22
3 Jenny Richards null CEO 45
4 Robert Black Daniel Smith Sales 22
5 Noah Fritz Jenny Richards Assistant 30
6 David S Jenny Richards Director 32
7 Ashley Wells David S Assistant 25
8 Ashley Johnson null Intern 25

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.