Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index

Constraints

Scroll Prev Top Next More

To control the data that enters your database, you can apply powerful data-integrity rules called constraints. By applying a constraint to a column, you can prevent irreconcilable and empty data from being entered. R:BASE uses the following constraints:

 

Primary Key - A column or set of columns that uniquely identify a row; in other words, each value in a primary key column is unique. A primary-key constraint prevents duplicate (non-unique) and null values from being entered. Even if you do not specifically define a constraint, all tables (in a well-designed database) should have a primary key. You can define one primary key per table.

 

Foreign Key - A column or set of columns that match values in a particular primary key or unique key defined in a different table. A value cannot be inserted or changed.

 

Unique Key - A column or set of columns that uniquely identify a row; in other words, each value in a unique-key column is unique. A unique-key constraint prevents duplicate (non-unique) and null values from being entered. The only difference between a unique key and a primary key is that you can define multiple unique keys per table.

 

Unique Index - A column or set of columns that uniquely identify a row, but cannot be referenced like a primary key or unique key. The differences between a unique key and a unique index is that the unique key must be defined a Not NULL.

 

Not NULL - Placing a not null constraint on a column requires that the data in the column must contain a value, and cannot be null. This prevents users from adding a "blank" value. A not null constraint cannot be added if the column already contains null values.

 

Constraints cannot be turned off and are always enforced; you must delete the constraint if you do not want it. However, because R:BASE works with constraints faster, use constraints instead of rules when possible.

 

You can remove constraints from columns. If you want to remove a primary- or unique-key constraint, you must first remove the foreign-key constraints that refer to it.

 

See also:

 

ALTER TABLE

CREATE INDEX

SET FASTFK

Data Designer