Sie sind auf Seite 1von 2

A row in a table represents a relationship among a set of values.

In the relational model, relation


refers to the table, tuple refers to the row and attribute refers to the column. Relation instance
refers to the specific instance of a relation, i.e., containing a specific set of rows.

The order in which tuples appear is irrelevant since a relation is a set of tuples. Set of permitted
values for an attribute is domain of that attribute. We require, for all relations r, the domains of all
attributes of r be atomic. A domain is atomic if elements of the domain are considered to be
indivisible.

Database instance is a snapshot of data in the database at a given instant in time. Database schema
is the logical design of the database.

The concept of a relation instance corresponds to the programming-language notion of a value of a


variable while the concept of relation schema corresponds to the programming language notion of
type definition. The value of a given variable may change with time; similarly, the contents of a
relation instance may change with time as the relation is updated. In contrast, the schema of a
relation does not generally change.

In other words, no two tuples in a relation are allowed to have exactly the same value for all
attributes.

Tuples within a given relation must be different.

If K is a superkey, then so is any superset of K. We are often interested in superkeys for which no
proper subset is a superkey. Such minimal superkeys are called candidate keys.

Primary key attributes are underlined.

A relation, say r1, may include among its attributes the primary key of another relation, say r2. This
attribute is called a foreign key from r1, referencing r2. The relation r1 is also called the referencing
relation of the foreign key dependency, and r2 is called the referenced relation of the foreign key.
The constraint from section to teaches is an example of a referential integrity constraint; a
referential integrity constraint requires that the values appearing in specified attributes of any tuple
in the referencing relation also appear in specified attributes of at least one tuple in the referenced
relation.

A query language is a language in which a user requests information from the database. Query
languages can be categorized as either procedural or nonprocedural. In a procedural language, the
user instructs the system to perform a sequence of operations on the database to compute the
desired result. In a nonprocedural language, the user describes the desired information without
giving a specific procedure for obtaining that information.

All procedural relational query languages provide a set of operations that can be applied to either a
single relation or a pair of relations. These operations have the nice and desired property that their
result is always a single relation.

In general, the natural join operation on two relations matches tuples whose values are the same on
all attribute names that are common to both relations.

The Cartesian product operation combines tuples from two relations, but unlike the join operation,
its result contains all pairs of tuples from the two relations, regardless of whether their attribute
values match.

Just as algebraic operations on numbers take one or more numbers as input and return a number as
output, the relational algebra operations typically take one or two relations as input and return a
relation as output.

For a union operation r ∪ s to be valid (and same for set difference), we require that two conditions
hold:

1. The relations r and s must be of the same arity. That is, they must have the same number of
attributes.

2. The domains of the ith attribute of r and the ith attribute of s must be the same, for all i.

Note that there is often more than one way to write a query in relational algebra.

A relation r by itself is considered a (trivial) relational-algebra expression. Thus, we can also apply
the rename operation to a relation r to get the same relation under a new name.

Das könnte Ihnen auch gefallen