1. A computer-implemented method of optimizing a nested database query that includes at least one inner sub-query, at least one outer sub-query, one or more window functions in the at least one inner sub-query, and one or more filtering operations in the at last one outer sub-query, wherein the computer-implemented method comprises: determining whether to represent one or more filtering operations of the at least one outer sub-query as one or more corresponding qualification operations associated with the one or more window functions in the at least one inner sub-query; and effectively representing the one or more filtering operations of the at least one outer sub-query as the one or more corresponding qualification operations associated with the one or more window functions in the at least one inner sub-query when the determining determines to represent the one or more filtering operations as the one or more corresponding qualification operations.