Query builder

Previous Top Next

Query builder represents dialog for simplification of creation of a query with use of 'drag and drop' technology.

The general view of dialogue is submitted in picture:

 

_engbm5680

 

In the top part of Query builder the panel of tools containing following command buttons is located:

ici_9096 -  Exit with saving of query.

ici_9097 -  Exit without saving of query.

ici_9098 -  Choice of DB location (Select database name).

ici_9099 -  New query.

ici_9105 -  Hide/show bookmarks (Settings, Query text, Query results).

ici_9106 -  Hide/show the list of DB tables names.

ici_9108 -  Execute query.

ici_9109 - Save results of query. At activation of the given button the window of Saving a data set into a file opens. In this window the fields displayed in the right list, their aliases (the user can set his own field name, having clicked twice by the left mouse button on the chosen cell) and type of saved file are set.

ici_9110 - Refresh tables list.

 

Query builder main window is divided onto two parts by vertical line:

In the left window the panel of design is located, on which the user places the tables used in query.

And in the right subwindow a list of database tables is located.  

Under the main window there is Query text bookmark. It contains a window of SQL-query editor. In the editor the text of query can be entered manually, however it increases mistake probability.

Below the operators panel containing command buttons for query forming is located.

Under operators panel there is a window in which functions and operators of SQL language are displayed. In the left part of window there is a tree of key functions. The user has an opportunity to move on sections of a tree. Automatically in the right part of a window the list of functions and operators is displayed.

 

Let's consider process of SQL-query forming.

If location of a database was not specified at activation of Query builder dialog, then set it, having pressed Select database name button on the tools panel. In the right subwindow the list of database tables will be displayed.

Mark the required table in the tables list with pressed left mouse button, drag it on the design panel. Names of the table and all its fields will be displayed on the panel.

Add the operator into window of SQL-query editor. The user can enter manually the name of operator, or press the command button on the operators panels, or execute the following actions:

- to choose the necessary section with the help of a tree of key functions;

- to choose the required operator in the list, for example SELECT, and, with pressed left  mouse button, drag it into window of SQL-query editor.

        or indication of a field which will be placed into resulting data set, choose it in the list of fields (on the design panel) and, with pressed left  mouse button, drag it into editor window.

To indicate name of the table from which selection of records is carried out, bring the mouse cursor to a badge with the image (located on the design panel at the end of the list of the table fields names) and, with pressed left mouse button, drag it into editor window.

Make up all query text, do not forget to separate operators, functions, names of fields and tables by blanks. It is possible to include fields from different tables into a data set.

To close the table, click the right mouse button on the list of table fields.

For query execution it is necessary to press the button with image of a yellow lightning in tools panel. Before query execution a check of its correctness takes place. At execution of correctly made query a window containing records of a data set, which is query result (Query results bookmark) appear. Results of query can be saved by pressing Save results button on the tools panel.

The query text can be saved in the project by pressing Ok button on tools panel.

 

Main information about SQL language.