Relational Algebra

Extended Operators of Relational Algebra

An Algebra of Relational Operations presented the classical relational algebra, and Relational Operations on Bags introduced the modifications required to treat relations as bags of tuples rather than sets. The ideas of these two sections serve as a base for most of

Extending the Projection Operator

Well now reexamine the projection operator πL(R) introduced in Set Operations on Relations under projection. In the classical relational algebra, L is a list of (some of the) attributes of R. We extend the projection operator to allow it to compute with components of tuples as well

Constraints on Relations

Relational algebra offers a means to express common constraints, such as the referential integrity constraints introduced in The Modeling of Constraints. Actually, we shall see that relational algebra provides us convenient ways to express a large variety of other constraints. Even

Referential Integrity Constraints

A common kind of constraint, called "referential integrity" in The Modeling of Constraints, declares that a value appearing in one context also appears in another, related context. We saw referential integrity as a matter of relationships "making sense". That is, if an object or

Additional Constraint Examples

The same constraint notation permits us to express far more than referential integrity. For instance, we can express any functional dependency as an algebraic constraint, although the notation is more awkward than the FD notation introduced in Functional Dependencies.

The Database Language SQL

The most frequently used relational DBMSs query and modify the database through a language called SQL (often pronounced sequel). SQL stands for "Structured Query Language". The portion of SQL that supports queries has capabilities very close to that of relational algebra, as

Selection in SQL

The selection operator of relational algebra, and much more, is available through the WHERE clause of SQL. The expressions that may follow WHERE contain conditional expressions like those found in common languages such as C or Java.

Queries Involving More Than One Relation

Much of the power of relational algebra comes from its ability to combine two or more relations through joins, products, unions, intersections, and differences. We get all of these operations in SQL. The set-theoretic operations - union, intersection, and difference - appear directly in

Interpreting Multirelation Queries

There are many ways to define the meaning of the select-from-where expressions that we have just studied. All are equivalent, in the sense that they each give the same answer for each query applied to the same relation instances. We shall examine each in turn.

Union, Intersection, and Difference of Queries

Sometimes we wish to combine relations using the set operations of relational algebra: union, intersection and difference. SQL provides corresponding operators that apply to the results of queries, provided those queries produce relations with the same list of attributes and

Page 2 of 3 Previous 1 2 3 Next