We present a new optimization method for nested
SQL query blocks with aggregation operators. The method is derived from the the- ory of dependency implication and tableau minimization.
It unifies and generalizes previously proposed (seemingly unrelated) algorithms, and can incorporate general database dependencies
given in the database schema.
We apply our method to query blocks with max, min aggregation op- erators. We obtain an algorithm which does not infer arithmetical or aggregation constraints, and reduces
optimization of such query blocks to the well-studied problem of tableau minimization. We prove a com- pleteness result for this algorithm: if two max, min blocks can be merged, the algorithm will detect this fact.