The Relation Model — Formal Definition

Montclair State University—Dept. of Computer Science
The Relation Model — Formal Definition
Definition 1. [Domain] A domain is a set of symbols. Typical
examples are all integers, all strings of length ≤ 30, the set
{red,green,blue}.
Definition 2. [Attribute] An attribute is a name plus a domain.
Examples: NumOfChildren:INTEGER, Color:{red,green,blue}.
Definition 3. [Relation] A relation with n attributes of domains
D1,D2,...,Dn, respectively, is a subset of the Cartesian product
D1 × D2 × ...× Dn.
Montclair State University—Dept. of Computer Science
Definition 4. [Relational Schema] The relational schema
is the set of all attributes in a relation.
Definition 5. [Tuple] A tuple is an element of a relation.
That means a relation R(A1 : D1,A2 : D2,...,An : Dn) consists of
tuples of n values v1,v2,...,vn, where vi is an element of
domain Di or the special value null. Notation: t =(v1,v2,...,vn)
or t =(A1 ⇒ v1,An ⇒ v2,...,An ⇒ vn).
Definition 6. [Value] A value is an element of a tuple.
Notation (Example): t[NumOfChildren]= 3.
Montclair State University—Dept. of Computer Science
Translation
Montclair State University—Dept. of Computer Science
Keys
Definition 7. [superkey] A superkey is a set of attributes
that uniquely identifies any tuple in the relation.
The relational schema itself is by definition a superkey for
the relation.
Definition 8. [(candidate) key] A (candidate) key is a
superkey for which no subset is a superkey.
Or: A key is a minimal set of identifying attributes.
Definition 9. [primary key] The primary key of a relation is
a single candidate key chosen by the database designer.
Montclair State University—Dept. of Computer Science
Constraints
Definition 10. [constraint] A constraint is a Boolean
expression on the values of one or more relations.
Constraints distinguish valid from invalid data in a
database.
Purpose: In a database system, the data in the database
must at all times satisfy all constraints (except during
transactions ∼→ later).
Example: Any value in the column DirectorID of the Movie
table must also exist in the column ID of the Director table.
Montclair State University—Dept. of Computer Science
Translation
Relational
Term
key
primary key
foreign key
foreign key
constraint
Informal Meaning
minimal set of attributes that uniquely identify a
tuple in a relation
a key explicitly marked during database design
set of attributes that corresponds to a key in a
different relation
constraint requiring that all values of the foreign
key are present in the other relation (= referential
integrity constraint)