12. The computer-readable non-transitory storage medium of claim 9 , wherein the code further causes the processor to: determine that the inner subquery specifies a where clause that computes a first set of values; determine that the outer subquery specifies a where clause that computes a second set of values; compare the first set of values with the second set of values; and responsive to determining that the second set of values is a subset of the first set of values, specify a where clause of the database query comprising the where clause of the outer subquery.
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.