Statistics by age group

A company needs to make statistics on the salary level of employees in each age bracket. Please retrieve the employee data from EMPLOYEE database table, and compute the number and average salaries of employees below 30, between 30 -40, and over 40.

Solution:

A
1
=demo.query("select * from EMPLOYEE")
2
[?<30,?<=40,null]
3
=A1.enum(A2,age(BIRTHDAY))
4
=A3.new(A2(#):Group,~.count():Count,round(~.avg(SALARY),2):AvgSalary)

The computation in A4 is shown below: