1.2 Common SQL Statement Rules
This section explains the rules common to SQL statements in this manual.
1.2.1 Names specified in SQL statements
The following names can be specified in SQL statements:
a. Schema names
b. Table names
c. Column names
d. Routine names
e. Parameter names
f. Trigger names
g. Host identifiers names
h. SQL variable names
i. Descriptor names
j. Connection names
k. SQL server names
l. Cursor names
m. Correlation names
n. SQL statement identifiers
o. Sequence names
The names indicated by a to c above are defined in the database. These names are determined when schemas and
tables are designed. The names indicated by d are routine names defined in the procedure routine definition or
function routine definition. The names indicated by e are the parameter names defined in the procedure routine
definition. Specify these names as is in SQL statements. The names indicated by f are the trigger names defined in
the trigger definition. For information about database definitions, procedure routine definitions, and trigger definitions,
see the "RDB User's Guide: Database Definition."
The names indicated by g are host variable names. Host variables are named in the embedded SQL declaration
clause and used in SQL statements. Host variable names are defined in C and COBOL85. These names must meet
the following conditions:
· Names must not begin with SQL.
For information on the data type of host variables, see Appendix A "SQL Data Types and Equivalent Host Variable
Data Types".
The names in h) are defined with compound statements consisting of procedure routine definitions.
The names in i) to n) are assigned in SQL statements. The data type for the names in i), j), and k) must be
character-string type. The rules for assigning the names in l), m), and n) are as follows:
· Names must start with an alphanumeric character.
· The second and subsequent characters must be alphanumeric or numeric or an underline.
· Lowercase characters are converted to uppercase characters.
· Names can be up to 18 characters long.
1.2.2 Data base used in examples
In this section, an inventory management data base for a retail store is used as an example of a data base. The same
data base is used throughout this manual in explanations of data manipulations. This data base contains the following
three tables used in running inventory management applications for the retail store.
STOCK table:
This table contains information about products handled and stock quantities.
ORDER table:
This table contains information about products, the quantities of products ordered, and the prices of products
by supplier.
COMPANY table:
This table contains information about names, telephone numbers, and addresses of customer companies.
These tables are contained in a schema called STOCKS.
STOCK table
Figure: Inventory management data base a) shows the contents of the STOCK table. The STOCK table contains the
following four columns:
3