Page 22 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 22
Unit 2: Database Relational Model
A relation consists of a heading and a body. A heading is a set of attributes. A body (of an n-ary Notes
relation) is a set of n-tuples. The heading of the relation is also the heading of each of its tuples.
A relation is defined as a set of n-tuples. In both mathematics and the relational database model,
a set is an unordered collection of items, although some DBMSs impose an order to their data. In
mathematics, a tuple has an order, and allows for duplication. E.F. Codd originally defined
tuples using this mathematical definition. Later, it was one of E.F. Codd’s great insights that
using attribute names instead of an ordering would be so much more convenient (in general) in
a computer language based on relations. This insight is still being used today. Though the
concept has changed, the name “tuple” has not. An immediate and important consequence of
this distinguishing feature is that in the relational model the Cartesian product becomes
commutative.
A table is an accepted visual representation of a relation; a tuple is similar to the concept of row,
but note that in the database language SQL the columns and the rows of a table are ordered.
A relvar is a named variable of some specific relation type, to which at all times some relation
of that type is assigned, though the relation may contain zero tuples.
The basic principle of the relational model is the Information Principle: all information is
represented by data values in relations. In accordance with this Principle, a relational database
is a set of relvars and the result of every query is presented as a relation.
The consistency of a relational database is enforced, not by rules built into the applications that
use it, but rather by constraints, declared as part of the logical schema and enforced by the DBMS
for all applications. In general, constraints are expressed using relational comparison operators,
of which just one, “is subset of”, is theoretically sufficient. In practice, several useful shorthands
are expected to be available, of which the most important are candidate key (really, superkey)
and foreign key constraints.
Interpretation
To fully appreciate the relational model of data, it is essential to understand the intended
interpretation of a relation.
The body of a relation is sometimes called its extension. This is because it is to be interpreted as
a representation of the extension of some predicate, this being the set of true propositions that
can be formed by replacing each free variable in that predicate by a name (a term that designates
something).
There is a one-to-one correspondence between the free variables of the predicate and the attribute
names of the relation heading. Each tuple of the relation body provides attribute values to
instantiate the predicate by substituting each of its free variables. The result is a proposition that
is deemed, on account of the appearance of the tuple in the relation body, to be true. Contrariwise,
every tuple whose heading conforms to that of the relation but which does not appear in the
body is deemed to be false. This assumption is known as the closed world assumption.
For a formal exposition of these ideas, see the section Set Theory Formulation.
Task Write total number of rules given by E.F. Codd.
LOVELY PROFESSIONAL UNIVERSITY 15