Active Query Builder is a two-way visual SQL query builder. It allows you to combine visual query building with direct SQL text editing.
To build a query visually drag database objects from the tree to the Design Pane. Joins between objects will be created automatically according to the foreign keys defined in the database. Check fields that you want to add to the query and define their properties (alias, aggregate, sorting, grouping and criteria) in the Query Column List below the Design Pane. See the User's Guide for details.
Modification of the query text is possible within the text editor at the bottom. To apply changes to the query builder (i.e. to parse a query and to represent it visually), click the Update button.
Active Query Builder allows building a query without the Design Pane. This way the user will be limited in defining properties of links and datasources of the query, but for those users who are not familiar with database object's relationship diagram this mode may seem less complicated.
To build a query one has to drag database object fields to the Query Column List and define query column's properties in the grid control. Appropriate objects will be added (and removed) to the query automatically, even if the user adds objects that are not directly linked to each other.
For example, by adding fields of Orders and Products tables to the query, the Order Details table will be added automatically.
Active Query Builder allows substituting unintelligible names of database objects and fields for user-friendly aliases ("Alternate Names"). Active Query Builder hides real database object names completely: the user may even combine visual query building with direct SQL text editing using alternate names. All aliased names that were used in the query will be substituted back for real names in the resultant SQL query text to execute a query against database server. A difference between user's and server's query text demonstrates the operating principle of this feature.
Active Query Builder allows defining objects that are actually sub-queries, but look like ordinary objects in the database and fields that are actually complex expressions or correlated sub-queries but look like ordinary fields. The user may combine visual query building with direct SQL text editing using virtual entities. In this demo, we have added a virtual field to the Orders table and two virtual objects called Orders_qry and Orders_tbl with virtual fields. All virtual entity names that were used in the query will be substituted back for sub-queries and expressions in the resultant SQL query text to execute a query against database server. A difference between user's and server's query text demonstrates the operating principle of this feature.
Active Query Builder allows to analyze complex SQL query structure.
The whole SQL query is decomposed into 3 levels that are represented by the respective entities: Query - SubQuery - UnionSubQuery. UnionSubQuery is an object representing single SELECT statement. Using it you may get access to it's parts: data sources, links, output expressions, grouping, sorting and criteria. Group of union sub-queries that are joined using one of the operators (UNION, EXCEPT, INTERSECT, MINUS) comprise a SubQuery. SubQuery object may represent a main query, a common table expression, a derived table or a sub-query that used in expression ("WHERE Field IN (SELECT ...)").
The current version of ASP.NET Edition displays the first union sub-query of the main query only, which does not prevent the component to deal with arbitrary complex queries. The whole query structure can be modified programmatically.