<P> Constraints make it possible to further restrict the domain of an attribute . For instance, a constraint can restrict a given integer attribute to values between 1 and 10 . Constraints provide one method of implementing business rules in the database and support subsequent data use within the application layer . SQL implements constraint functionality in the form of check constraints . Constraints restrict the data that can be stored in relations . These are usually defined using expressions that result in a boolean value, indicating whether or not the data satisfies the constraint . Constraints can apply to single attributes, to a tuple (restricting combinations of attributes) or to an entire relation . Since every attribute has an associated domain, there are constraints (domain constraints). The two principal rules for the relational model are known as entity integrity and referential integrity . </P> <P> A primary key uniquely specifies a tuple within a table . In order for an attribute to be a good primary key it must not repeat . While natural attributes (attributes used to describe the data being entered) are sometimes good primary keys, surrogate keys are often used instead . A surrogate key is an artificial attribute assigned to an object which uniquely identifies it (for instance, in a table of information about students at a school they might all be assigned a student ID in order to differentiate them). The surrogate key has no intrinsic (inherent) meaning, but rather is useful through its ability to uniquely identify a tuple . Another common occurrence, especially in regard to N: M cardinality is the composite key . A composite key is a key made up of two or more attributes within a table that (together) uniquely identify a record . (For example, in a database relating students, teachers, and classes . Classes could be uniquely identified by a composite key of their room number and time slot, since no other class could have exactly the same combination of attributes . In fact, use of a composite key such as this can be a form of data verification, albeit a weak one . </P> <P> A foreign key is a field in a relational table that matches the primary key column of another table . The foreign key can be used to cross-reference tables . Foreign keys do not need to have unique values in the referencing relation . Foreign keys effectively use the values of attributes in the referenced relation to restrict the domain of one or more attributes in the referencing relation . A foreign key could be described formally as: "For all tuples in the referencing relation projected over the referencing attributes, there must exist a tuple in the referenced relation projected over those same attributes such that the values in each of the referencing attributes match the corresponding values in the referenced attributes ." </P> <P> A stored procedure is executable code that is associated with, and generally stored in, the database . Stored procedures usually collect and customize common operations, like inserting a tuple into a relation, gathering statistical information about usage patterns, or encapsulating complex business logic and calculations . Frequently they are used as an application programming interface (API) for security or simplicity . Implementations of stored procedures on SQL RDBMS's often allow developers to take advantage of procedural extensions (often vendor - specific) to the standard declarative SQL syntax . Stored procedures are not part of the relational database model, but all commercial implementations include them . </P>

Is a field in one table whose values are required to match a primary key in another table