Constraints
A constraint is a rule that defines the relationship between tables through a foreign key, or that uniquely identifies a record in a table or business object through a primary key or unique key.
Infor Operations and Regulations recognizes these constraints:
Constraint | Description |
---|---|
Primary key | A primary key constraint indicates that a column is the primary key for the table. A table's primary key uniquely identifies the table. A table should have only one primary key constraint. Depending on the table type, when you first define a table, a primary key column and a primary key constraint are automatically generated, and the column is linked to the constraint. |
Foreign key | Foreign key constraints indicate that the column has a relationship to the primary key of another table. By requiring a valid key value from another table, the foreign key constraint prevents inconsistent data from being entered into the database. A table can have multiple foreign key constraints.
Note: Infor Operations and Regulations automatically adds an index for each foreign key constraint that you add.
|
Unique key | A unique key constraint indicates that a column is a unique key, requiring a unique value, but is not the primary key for the table. For example, a unique key constraint could be put on a column that tracks account numbers. Typically, account numbers must be unique, but you might not want to use it as the primary key for a record. A table can have multiple unique key constraints. |
Check constraint | Check constraints define which data values are acceptable for a table or column. For example, a check constraint for a table might require that only one of three columns has data. A check constraint for a column might ensure that a phone number doesn't contain letters or that a dollar amount always has two decimal places. The constraint is written in SQL. |