Database Reference
In-Depth Information
In is very important for a user to know that what data can be stored or retrieved from a data-
base. Constraints are rules restricting for storing and retrieving data. They should be added
after a logical data model is stable. Primary and, to some extent, foreign key constraints fit
this definition. They are critical components of a relational database.
4.7.1 Key Constraints
Keys are important for a table structure for the following reasons:
They ensure that each record in a table is uniquely identified. The complete set of records
within the table constitutes the collection, and each record represents a unique instance of
the table's subject within that collection. A key is mean of accurately identifying each in-
stance
 Various types of integrity, are established and enforced by keys. Keys play a major role
of table-level integrity and relationship-level integrity. Keys ensure that a table has unique
records and that the fields those are used to establish a relationship between a pair of tables
always contain matching values.
 Table relationships are established by keys.
4.8 CANDIDATE KEYS
The first type of key that is establish for a table is the candidate key , which is a field or
group of fields that uniquely identifies a single instance of the table's subject. Each table
must have at least one candidate key. It is examined from the table's pool of available can-
didate keys and designate one of them as the official primary key for the table.
Before, a field is designated as a candidate key, we must make certain it complies with all
of the elements of a Candidate Key. Set of guidelines determines whether the field is fit to
serve as a candidate key. A field cannot be designated as a candidate key if it fails to con-
form to any of these elements.
4.8.1 Elements of a Candidate Key
 It cannot be a multipart field. Usage of one field as an identifier is a bad idea.  It should
not contain null values because a null value represents the absence of a
value
 Optional value is not allowed in completely or in part. An optional value may be
null at some point.
 It comprises a minimum number of fields necessary to define uniqueness.
Combination of fields can be used as a candidate key, so long as each field
Search WWH ::




Custom Search