NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
P-27
Primary Keys
The following SQLCI example uses a string literal within a string literal because the
prepared statement includes a string literal itself. (Double quotes delimit the outer
string, and two quotation marks represent one quotation mark within the string.)
>> PREPARE ADDSUP FROM "INSERT INTO INVENT.SUPPLIER"
+> &" VALUES (?, ?, ?, ""BEND"", ""OREGON"", ""97709"" )";
---SQL command prepared.
>> EXECUTE ADDSUP USING 572, "ULTRA-TECH",
+> &"240 INDUSTRIAL WAY";
--- 1 row(s) inserted.
Primary Keys
A primary key is a column or group of columns whose values uniquely identify the rows
in a table and (along with file organization and any collations associated with the file)
determine the order in which the rows are stored. Each base table and each index has a
primary key.
The primary key of a table stored in a key-sequenced file can be defined by the user
(PRIMARY KEY clause of the CREATE TABLE statement), defined by the file system
(SYSKEY column), or defined by both the user and the file system (CLUSTERING
KEY clause of CREATE TABLE, plus the SYSKEY column).
The primary key of a table stored in a relative or entry-sequenced file is always defined
by the file system.
The primary key of an index includes the keytag column, the indexed columns, and—for
nonunique indexes—the primary key of the underlying table.
Primary key values affect the order in which rows are stored and retrieved. The length of
the primary key is a factor in determining the maximum number of partitions for a table
or index. The number of columns in a primary key is a factor in determining the number
of columns that can be indexed and the maximum number of indexes possible on a table.
A primary key is sometimes called a physical primary key.
For more information, see these entries:
Clustering Keys
Index Keys
Syskeys (system-defined primary keys)
User-Defined Keys
(user-defined primary keys)
Print Item
A print item identifies an item to print in an SQLCI report writer report, optionally
accompanied by instructions for formatting the item. A print item can generally be a