In: Computer Science
what aggregate functions priobably would be usefull to school administrators to analyze student population and why? (school environment database management)
// Hope this answer would be beneficial for u
// If u face any doubts feel free to ask in comments as I would be very happy to solve them
In database management an aggregate function is a function where the values of multiple rows are grouped together as input on certain criteria to form a single value of more significant meaning.
Some of the various aggregate functions are-:
1) Count() 2) Sum() 3) Avg() 4) Min() 5) Max()
These could be used in a normal school management system in counting like total students in a school or in a particular stream or class, calculating average number of boys in each class, class with minimum number of boys/girls or the maximum number of boys/girls etc.
Suppose we have given data-:
Total Section Number of boys Number of girls --------------------------------------------------------- 120 A 80 60 90 B 40 50 105 C 60 45 105 D 70 35 85 E 60 25 95 F 50 45
// The normal way to write a query is like this:
SELECT COUNT(*) AS NumStudents FROM table_name;
i) If we want to calculate the number of sections with equal/distinct number of students then count() can be used--
Count(Distinct Total): Return number of distinct Non Null values over the column Total
ii) If we want to calculate the sum of Total students where total is same/distinct then sum() can be used---
sum(Total): Sum all Non Null values of Column salary
sum(Distinct Total): Sum of all distinct Non-Null values
iii) Avg(Number of girls) = Sum(number of girls) / count(number of girls)
And also
Min(Number of boys): Minimum value in
the Number of boys column except NULL i.e., 40.
Max(Number of girls): Maximum value in
the Number of girls column i.e., 60.
This was just a example to show how these aggregates can be used in the school management system to solve queries regarding population of students....
// In case u have a doubt please ask in the comment section
// Thank You