Database reference guide

HOME

Structure

Basic Structure

The basic form of a simple NSQL query is:

SELECT <list>

FROM <list>

WHERE <statement>;

A query of this type will generate a set or Domain of records that satisfies the WHERE condition and contains the columns specified in the SELECT list (from the tables listed in the FROM clause).

Note: All NSQL statements must end in a semicolon.

Example Query

To perform a query with Engine one must make a new NSQL object in the system by creating an IQuery object.

Consider the following Visual Basic example:

Dim Qry as IQuery

Set Qry = System.NewQuery( “Select * From Customer;”)

Qry.Calculate

TextBox1 = Qry.RowBuffer(500,0)

In this example, a new query is created in this user's ISession (called System) then calculated and the results are placed in a text box on a form.

Domains

The basic form of a Domain producing NSQL query is:

SELECT [{DISTINCT},{DISTINCTROW}] <list of columns>

[INTO {“FILE”} or {[DATABASE].[TABLE]})

FROM <list of tables>

[WHERE <conditions>]

[ORDER BY <list of columns> , [DESC]];

Statistical Values

For queries producing a single statistical value the format is as follows:

SELECT FUNCTION(<column>)

FROM <table>

[WHERE <conditions>];

Where FUNCTION is one of the statistical functions defined under the section Aggregate Functions

Crosstabulations

For queries producing one or two dimensional crosstabulations:

SELECT {COUNT(*)} or {FUNCTION<column>}

FROM <list of tables>

[WHERE <conditions>]

GROUP BY <vertical axis column>

[PIVOT BY <horizontal axis column>];

Each cell in the crosstab will either contain a count of records or an aggregation defined by the function FUNCTION of a particular column, FUNCTION must be one of:

SUM - The sum of all cell values for the column

MEAN - The average column value of each cell

MIN - The minimum column value of each cell

MAX - The maximum column value of each cell

  Online & Instructor-Led Courses | Training Videos | Webinar Recordings
© Alterian. All Rights Reserved. | Privacy Policy | Legal Notice