9. The computer-readable non-transitory storage medium of claim 8 , wherein the code further causes the processor to: identify an inner aggregate function specified in the inner subquery and an outer aggregate function specified in the outer subquery; determine whether a result of the inner aggregate function is provided as an input to the outer aggregate function; responsive to determining that the result of the inner aggregate function is provided as the input to the outer aggregate function, determine a new aggregate function corresponding to a composition of the inner aggregate function and the outer aggregate function; and wherein the combined database query specifies the new aggregate function.
11. The computer-readable non-transitory storage medium of claim 9 , wherein the inner aggregate function is a sum of values and the outer aggregate function performs a count of values, wherein the new aggregate function corresponding to the composition of the inner aggregate function and the outer aggregate function computes a count of values.