Queries

When a form or report is designed, it can retrieve data from one of three places; directly from a table (as demonstrated by the forms in the previous chapter), from a free-text SQL query (which will be described later), or from a Rekall query. It is probably true that while forms are most likely to access tables directly, reports are more likely to use free-text SQL queries or Rekall queries. For this reason, this chapter concentrates on the latter, before we move on to reports.

To reiterate what has been said earlier, there are two ways that the term query can be used, either in the context of an SQL query (select ... from ...) or in the context of a Rekall query. This chapter talks about the latter (although, ultimately, a Rekall query is used to generate an SQL query which is executed by the server database).

A Rekall query essentially sepecifies a set of tables (possibly only a single table), a set of relationships between them, and a set of SQL expressions; the latter may be used to specify data to be retrieved from the tables, or for functions such as ordering or filtering. These component parts are combined to generate the SQL query. In addition, however, when Rekall queries are used in the design of forms and reports, Rekall can use the relationships between the tables to arrange the data in form-subform (or, analagously, report-subreport) structures.

Rekall does not have anything equivelent to the update, insert or delete queries provided by Microsoft Access. These will probably be added at a later date, but you will be able to achieve the same funcionality directly via python scripts and the interface between python and the server databases.

This section starts by describing the construction of a query which retrieves data from the demonstration Orders database.

Creating Queries
Joins: Inner, Outer and none
Using a Query in Forms and Reports
Free-Text Queries