Database Relations
1. Relation schema
Named relation defined by a set of attribute and domain name pairs.
2. Relational database schema
Set of relation schemas, each with a distinct name.
Properties of Relations
Relation name is distinct from all other relation names in relational schema.
Each cell of relation contains exactly one atomic (single) value.
Each attribute has a distinct name.
Values of an attribute are all from the same domain.
Each tuple is distinct; there are no duplicate tuples.
Order of attributes has no significance.
Order of tuples has no significance, theoretically.
Relational Keys
Superkey
An attribute, or a set of attributes, that uniquely identifies a tuple within a relation.
Candidate Key
Superkey (K) such that no proper subset is a superkey within the relation.
In each tuple of R, values of K uniquely identify that tuple (uniqueness).
No proper subset of K has the uniqueness property (irreducibility).
Primary Key
Candidate key selected to identify tuples uniquely within relation.
Alternate Keys
Candidate keys that are not selected to be primary key.
Foreign Key
Attribute, or set of attributes, within one relation that matches candidate key of some (possibly same) relation.
Relational Integrity
Null
Represents value for an attribute that is currently unknown or not applicable for tuple.
Deals with incomplete or exceptional data.
Represents the absence of a value and is not the same as zero or spaces, which are values.
Entity Integrity
In a base relation, no attribute of a primary key can be null.
Referential Integrity
If foreign key exists in a relation, either foreign key value must match a candidate key value of some tuple in its home relation or foreign key value must be wholly null.
Enterprise Constraints
Additional rules specified by users or database administrators.
No comments:
Post a Comment