Database Reference
In-Depth Information
ing relation. A data manipulation solution comprises a set of these operations per-
formed on relations in a definite sequence.
Relational Calculus. Applies data manipulation conditions to rows and columns of
relations. A data manipulation solution does not contain a series of operations but
has a single solution statement to produce the necessary result.
Both relational algebra and relational calculus are generic languages. Popular
languages included in commercial database management systems implement ele-
ments of these generic languages. In these generic languages, Dr. Codd has stipu-
lated the semantics and syntax and has shown how these can be applied to perform
data manipulation. Commercial vendors build their language implementations
based on the two generic languages. Structured Query Language (SQL) is one such
implementation based on the generic languages, mostly based on relational calcu-
lus. We will look at SQL in Chapter 13.
Let us now examine the provisions in these two languages. Remember that these
are generic languages. That means that no programs are written using the syntax
and semantics of the native operations in these languages. No program code is
directly written to contain relational algebra and relational calculus commands or
operations. However, the commercial data manipulation languages are built based
on the operations and commands of the two generic languages. Therefore, to under-
stand how data manipulation is made possible in a relational data model, you need
to gain a good understanding of the two generic languages. We will now explore the
major operations and constructs of the two languages. Note the underlying princi-
ples. Study the various operations and understand how they produce the required
results.
Relational Algebra
In relational algebra, you have operations that work on relations. Some opera-
tions work on a single relation and others on two relations at a time. A solution
for data retrieval consists of a set of operations performed in a certain order.
When all the operations are performed in sequence, the final result is obtained.
For example, the final result may be the retrieval of all orders for a specific
customer.
Note, however, that the result is always a relation. In the case of the retrieval of
orders for a specific customer, the result is the set of orders satisfying the given
condition. The result is therefore a relation consisting of columns representing the
attributes of the ORDER relation and only those rows satisfying the condition of
belonging to the specific customer. In any case, the result consists of a relation with
rows and columns.
Sometimes, the resulting relation may contain just one column and many rows,
may contain many columns and just one row, or may contain just one column and
just one row. In every case, the result is still a relation.
Relational algebra consists of the following nine major operations:
SELECT
PROJECT
Search WWH ::




Custom Search