Try OpenEdge Now
skip to main content
SQL Development
OpenEdge SQL Data Definition Language : Maintaining data integrity : Types of integrity constraints : Primary keys
Primary keys
A primary key consists of one or more columns in a table that uniquely identifies each row. For example, the supp_no column value in the supplier table must be unique. Every row of the table is uniquely identified by this column value. A table can contain only one primary key constraint. If you supply a duplicate value for a primary key column in an INSERT operation, the operation returns an error.
You can design your database table so that there is only one column that distinguishes a given row from other rows. In this case, a single column is the unique identifier of the table. For example, the supp_no column is a primary key for the supplier table. Primary key constraints are defined in the column definitions of a table.
In the following example, the supp_no column is a unique identifier in the supplier table, and the key consists of only one column. This example shows how to create a column-level primary key on the supplier table.
last_name CHAR (30),
status SMALLINT,
city CHAR (20)
) ;