Database - Maple Programming Help

Home : Support : Online Help : Connectivity : Database Package : Database/QueryBuilder

Database

 QueryBuilder
 Database query builder Assistant

 Calling Sequence QueryBuilder( conn, opts )

Parameters

 conn - (optional) database connection opts - (optional) equation of the form advanced=boolean

Description

 • The QueryBuilder command opens an Assistant that facilitates building SQL queries. The Assistant queries a database for table and column information. From the returned lists, you can select tables and columns.
 • If given, the conn argument must specify an instance of a connection that the Assistant can use to contact the database.  If conn is not given, you must open a connection using the File>Open Connection menu item before querying the database.  The File>Open Connection menu item opens the Database connection builder Assistant.
 • The QueryBuilder Assistant has two different views for creating queries.  The Simple interface is a very basic interface allowing you to select columns from tables with an optional WHERE clause.  This view is primarily intended for users unfamiliar with complex query options.  This view is opened by default when the QueryBuilder command is executed. The second view is the Advanced interface.  This provides access to a far more complex range of query options, including WHERE, GROUP BY, HAVING, and ORDER BY clauses; JOINS, column, and table aliasing; and column expressions.
 • The structure of the two views is similar.  Both have a section for selecting columns (the SELECT area), a section for selecting tables (the FROM area) and a section for selecting clauses.  These sections are arranged vertically, with the SELECT area above the FROM area which is above the clauses area.
 • The SELECT area contains a list of columns that can be selected from the tables currently selected within the FROM area (items in the FROM list must be selected before they appear in the SELECT list).  In the Advanced view, the SELECT area may also contain column expressions and the FROM area may contain joins.
 • Once a query has been constructed, it can be exported or executed. By exporting the query, the text of the query is written to a file or returned to the worksheet as a string.  Executing the query will cause the query to be evaluated by the database and the result returned to Maple.  The resulting data can be managed in four ways.  A browser window can be opened to display the data (this does not close the Assistant). Otherwise the data can be returned to the worksheet as a Result, as a table, or as an Array.  The conversion to a table or an Array is performed using the ToMaple command. The Assistant is closed when executing to one of these data types.
 • For detailed information, see the help menu item in the Query Builder Assistant window.

Examples

To start the Query Builder Assistant, use the Database:-QueryBuilder command.

 > $\mathrm{driver},\mathrm{conn}≔\mathrm{Database}\left(\right):$
 > $\mathrm{Database}:-\mathrm{QueryBuilder}\left(\mathrm{conn}\right)$