The SQL Command and Statements

The SQL command

SQL statements can be tested while logged on to Reality by using the SQL TCL command:

SQL sql_statement {(options}

Options

C Turns on the COUNT option (similar to English).

D8 Displays optimisation decisions.

O Turns all SQL optimisation off.

S Turns off sort optimisation.

T Turns off table access optimisation (item-id and index optimisation).

V Displays the version numbers of the SQL server and compiler.

W Turns off multi-table WHERE clause optimisation.

SQL Statements

The following statements are currently supported by Reality. Detailed descriptions of these statements are provided following the lists. The syntax of the SQL search condition element and SQL numeric expression element is described independently.

Creating, Deleting and Updating Tables

ALTER TABLEAdds columns to an existing table.

CREATE TABLECreates an SQL table, defining columns and constraints.

DROP TABLEDeletes an SQL table.

Creating, Deleting and Updating Indexes

CREATE INDEXCreates an index on specified columns in an SQL table.

DROP INDEXDeletes an index in an SQL table.

Retrieving Information From a Table

SELECTLists rows from a table.

Granting and Revoking Privileges

GRANTGives privileges for a particular table to users.

REVOKERevokes privileges for a particular table to users. Reverses the action of the GRANT command.

Inserting, Deleting and Updating Rows

INSERTAdds new rows Into a table.

DELETERemoves rows from a table.

UPDATEUpdates rows in a table.

Verifying a Table

VERIFYChecks that table data matches the specified data type for each column.