366
Relations, Functions, and Matrices
1
N
Name
Address
City
State
Person
Owns
Pet
Breed
PetType
PetName
Figure 5.10
Relational Model
Another representation of an enterprise, called a relational model, can be developed from the E-R model. Both the entity sets and the relationships of the E-R
model become relations (in the mathematical sense) in the relational model. The
relations are described by tables. A relational database consists of collections of
such tables.
An entity set table is named for the entity set. Each row in the table contains
the values of the n attributes for a specific instance of that entity set. Thus the relational table may be thought of as a set of n-tuples (rows), and an individual row is
called a tuple. True to the idea of a set, no duplicate tuples exist, and no ordering
of the tuples is assumed. The ordering of the attributes is unimportant, except that
consistency must be maintained; that is, each column in the table contains values
for a specific attribute in all of the tuples. The number of attributes (columns)
is called the degree of the relation. The number of n-tuples (rows) is called the
cardinality of the relation; it is the cardinality (in the set-theoretic sense) of the
set of rows.
More formally, a database relation is a subset of D 1 × D 2 × c × D n , where
D i is the domain from which attribute A i takes its values. This means that the
database use of the word relation is consistent with our definition of an n-ary
relation on multiple sets (page 330). Beyond the data in the table itself, additional
information, sometimes called metadata—data about data—is needed to specify
the domain for each attribute. Is the domain the set of all possible strings, or do
these strings have to follow a specific format? Is the domain the set of integers or
does it have to be the set of integers within some specific range? Does the attribute
represent a date? If so, the domain has to specify the specific date format to be
used, for example, March 13, 2014 or 3/13/14 or 3/13/2014, and so forth. In addition, each attribute domain D i is assumed to contain a special NULL value (empty
Relations, Functions, and Matrices
1
N
Name
Address
City
State
Person
Owns
Pet
Breed
PetType
PetName
Figure 5.10
Relational Model
Another representation of an enterprise, called a relational model, can be developed from the E-R model. Both the entity sets and the relationships of the E-R
model become relations (in the mathematical sense) in the relational model. The
relations are described by tables. A relational database consists of collections of
such tables.
An entity set table is named for the entity set. Each row in the table contains
the values of the n attributes for a specific instance of that entity set. Thus the relational table may be thought of as a set of n-tuples (rows), and an individual row is
called a tuple. True to the idea of a set, no duplicate tuples exist, and no ordering
of the tuples is assumed. The ordering of the attributes is unimportant, except that
consistency must be maintained; that is, each column in the table contains values
for a specific attribute in all of the tuples. The number of attributes (columns)
is called the degree of the relation. The number of n-tuples (rows) is called the
cardinality of the relation; it is the cardinality (in the set-theoretic sense) of the
set of rows.
More formally, a database relation is a subset of D 1 × D 2 × c × D n , where
D i is the domain from which attribute A i takes its values. This means that the
database use of the word relation is consistent with our definition of an n-ary
relation on multiple sets (page 330). Beyond the data in the table itself, additional
information, sometimes called metadata—data about data—is needed to specify
the domain for each attribute. Is the domain the set of all possible strings, or do
these strings have to follow a specific format? Is the domain the set of integers or
does it have to be the set of integers within some specific range? Does the attribute
represent a date? If so, the domain has to specify the specific date format to be
used, for example, March 13, 2014 or 3/13/14 or 3/13/2014, and so forth. In addition, each attribute domain D i is assumed to contain a special NULL value (empty
