SQL queries

The program provides you with an access, in read-only mode, to database structures used to define maps, layers, shapes and others, using SQL queries. This option is available in the Tools->SQL query menu or the toolbar button . In the left panel of the window (Fig. 20), a list of tables (map layers; icon ), columns of individual tables (icon ), including columns with a master key (icon ) and a list of available functions (icon ) are visible in a form of a tree structure.

SmallMap - SQL Query

Fig. 20. SQL Query editor window.

Using the SQL query language, the user can create a report using data from any table contained in the database (see Figure 20), but it is not possible to modify, add or delete any data.

Queries are stored in the default "SQLs/" directory. They are edited in the window with the highlighted SQL syntax. The queries are launched by File->Execute (F8) command or the button on the toolbar. If the query generates results, they are displayed in a form of a list that appears below the editing window; otherwise, the user is notified about the result of the query via a pop-up window with an appropriate message. If a query error occurs, relevant information appears in the status bar or in the information pop-up.

If the results of the SQL query include shape identifiers of the current layer, it is possible to highlight them on the map (see Fig. 16). To do this, select Tools->Add Group from Result (icon ) and specify the map layer and the field (name) of the shape identifier (Fig. 21). This option is available if the edit mode is checked.

SmallMap - Group From Result

Fig. 21. Window for selecting layer and shape identifier from the results of the SQL query.


Updated: 29/01/20