The SQL database query language is the standard way to represent and manipulate data in this decade. By the nesting of query blocks to an arbitrary depth, we can describe more powerful expressions. Optimization of nested queries has received considerable attention over the last decade. Several algorithms to transform nested queries into semantically equivalent canonical queries have been proposed. However, they have not included complex correlation predicates and not considered the statistic information in transforming nested queries.
In this thesis, we propose a new unfied algorithm to transform nested queries into semantically equivalent canonical queries. And we incorporate the statistical information in query transformation. We also show that our algorithm can handle complex query including disjunctive join predicate.