I’m having a problem to express mathematically an aggregate function

I have a set C who is composed by m elements e

C = {e1, e2, …, em}

`select property_1 , property_2 , property_3 , property_N from element `

each element e has n properties

eProperties = {p1, p2, …, pn}

I need to apply an aggregate function like sum, min or max grouping by some of eProperties over each e elements in C

`select property_2 , property_3 , property_N , count(property_1) [countElements] , min(property_1) [min_Property_3] , max(property_1) [max_Property_3] from element group by property_2 , property_3 , property_N `

and the result will be p subsets SC, where each e element will be classified by the value of their properties, for example, a subset(first row) will have all e elements with property2 = 1, property3 = 3, and propertyN = 2 this subset has 26 elements.

How can I express that function from C to p subsets SC?

Can you recommend me some book?

Thanks in advance.