Latest Posts

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.

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

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

Outerjoins

An attribute of the join operator is that it is possible for certain tuples to be "dangling"; that is, they fail to match any tuple of the other relation in the common attributes. Dangling tuples do not have any trace in the result of the join, so the join may not represent the data 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

Grouping

Sometimes we do not want simply the average or some other aggregation of an entire column. Rather, we need to examine the tuples of a relation in groups, equivalent to the value of one or more other columns, and we aggregate only within each group. As an example, assume

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

Selection on Bags / Product of Bags / Joins of Bags

To apply a selection to a bag, we apply the selection condition to each tuple separately. As always with bags, we do not remove duplicate tuples in the result.

Union, Intersection, and Difference of Bags

When we take the union of two bags, we add the number of occurrences of each tuple. That is, if R is a bag in which the tuple t appears n times, and S is a bag in which the tuple t appears m times, then in the bag R U S tuple t appears n + m times. Note that either n or m (or

Relational Operations on Bags

While a set of tuples (i.e., a relation) is a simple, natural model of data as it might appear in a database, commercial database systems rarely, if ever, are based entirely on sets. In some situations, relations as they appear in database systems are allowed to have duplicate