3. Using the Tables Utility : Create a Table : Column Specification—Key Numbers
 
Share this page                  
Column Specification—Key Numbers
A key number is optional. When you specify a key number for a data column, data entered into the table is automatically sorted by ascending data value in the key column. For example, if a column named Lastname had the key number of 1, all data in the table is stored according to the alphabetic order of the names in the Lastname column.
You can specify more than one column as a key. This is known as a multicolumn key. The data column is sorted with the lowest key number first, then the column with the next highest number, and so on, until all the key columns are sorted.
For example, in a table containing information about employees, if the Department data column is key 1, and the Lastname column is key 2, all the data rows for each department are stored together, and within each department group the rows are alphabetized by last name.
When you are finished creating the table, you can optionally specify that all key columns in the table be used as unique constraints. These constraints prevent the user from entering multiple rows of data that have identical values in the key columns. For details, see How Unique Keys Are Set (see page How Unique Keys Are Set).
You can also use ISQL in the Interactive Terminal Monitor or SQL outside of the Tables Utility to specify unique constraints for the table, using the SQL modify statement. For details, see the SQL Reference Guide.