# Specifying the Properties of an Entity Constraint

While you are creating an entity constraint with the Entity Constraint Wizard, use the Properties page to enter specific details about the key constraint.

Key Constraint

> Select the type of key constraint you want to create.

> Primary

> > The column or set of columns included in the definition of a table’s PRIMARY KEY constraint. The attributes, or set of attributes, you chose in the Attributes panel will be interpreted as columns participating in the table's primary key constraint. These attributes will be used to represent unique values in the corresponding database table columns; a primary key's values uniquely identify the rows in a table. The primary key integrity constraint guarantees the following:

> > - No two rows of a table have duplicate values in the specified column, or set of columns.

> > - The primary key columns do not contain nulls (that is, a value must exist for the primary key columns in each row).

> > Only one primary key can be defined in a table.

> Unique

> > The column, or set of columns, included in the definition of a table's primary key constraint. A primary key's values uniquely identify the rows in a table. You can define one or more unique keys for each table.

> Check

> > The check integrity constraint does not use attributes. A CHECK integrity constraint on a column or set of columns requires that a specified condition be `true` for every row of the table. If a DML statement results in the condition of the CHECK constraint evaluating to `false`, the statement is rolled back.

> > If you select Check, you must also enter a condition. An example of a condition would be a PL/SQL code fragment that checks that a column value is non-null. The condition of a CHECK constraint has some limitations:

> > - It must be a Boolean expression evaluated using the values in the row being inserted or updated.

> > - It cannot contain subqueries, sequences, the SQL functions `SYSDATE, UID, USER, USERENV,` or the pseudocolumns `LEVEL` or `ROWNUM`.

> > Foreign

> > > The column or set of columns included in the definition of a referential integrity constraint.

> > > If you select Foreign, you must also enter the foreign key references.

> > > The attributes or set of attributes you chose in the Attributes panel will be interpreted as columns participating in a referential integrity constraint. A referential integrity constraint requires that, for each row of a table, the value in the foreign key matches a value in the primary key. If you select Foreign, you must also enter the primary key (or unique key) constraint name of a primary or unique key that the foreign key references,

> > > References

> > > > Enter the primary key (or unique key) constraint name that the foreign key references.

> > > Cascade Delete

> > > > If you select this option, when rows containing referenced key values are deleted, then all rows in child tables with dependent foreign key values are also deleted; that is, the delete "cascades".

> > > > For example, if a row in a parent table is deleted, and this row's primary key value is referenced by one or more foreign key values in a child table, the rows in the child table that reference the primary key value are also deleted from the child table.

> Validation Options

> > Select from these key validation options.

> > Mandatory

> > > If you select Mandatory, the column or set of columns must be non-null.

> > Deferrable validation

> > > Indicates that constraint checking can be deferred until the end of the transaction.

> > > Initially deferred validation

> > > > Implies that this constraint is DEFERRABLE and specifies that, by default, the constraint is checked only at the end of each transaction.

> > Disable validation

> > > Disables the constraint, drops the index on the constraint, and disallows any modification of the constrained columns. Any new or modified columns can violate the constraint.

> > Enable validation, validate existing data

> > > The constraint is checked and must be true for all new and pre-existing column data.

> > Enable validation

> > > Is the same as ENABLE. The constraint is checked and is guaranteed to hold for all new rows. Pre-existing column data is not checked.