9. The method according to claim 1 , wherein generating the first database query comprises: generating five data sets to store database query fragments; for each leaf in the first set, adding one or more database query fragments to one or more of the five data sets based on attributes of the leaf; and constructing the first database query by appending together the database query fragments from the five data sets.
9. The method according to claim 1 , wherein generating the first database query comprises: generating five data sets to store database query fragments; for each leaf in the first set, adding one or more database query fragments to one or more of the five data sets based on attributes of the leaf; and constructing the first database query by appending together the database query fragments from the five data sets. 10. The method according to claim 9 , wherein the first database query comprises an SQL (Structured Query Language) query, and the five data sets corresponds to SQL commands for SELECT, JOIN, WHERE, GROUP BY, and HAVING.