Meet Lara — your AI assistant for everything. 💬 Try it now.

Loading...

Relational Algebra

Databases

Relational algebra is a formal system for handling relations. With it, we can perform various operations on relations, similar to how we can perform union, intersection, or difference on sets. The result of the operations is always another relation, so we stay within the set of relations (closure).

Basic Operations

  • Union: R ∪ S = { (a,b) | (a,b) ∈ R or (a,b) ∈ S }. Defined only if R and S come from the same universe.
  • Intersection: R ∩ S = { (a,b) | (a,b) ∈ R and (a,b) ∈ S }.
  • Difference: R - S = { (a,b) | (a,b) ∈ R and (a,b) ∉ S }.
  • Complement: R^c = all pairs in the universe not in R.
  • Composition: R ∘ S = { (a,c) | ∃ b: (a,b) ∈ R and (b,c) ∈ S }.

Example

Let R = { (1,2), (2,3) }, S = { (3,4) }, universe U = {1,2,3,4} × {1,2,3,4}.

  • R ∪ S = { (1,2), (2,3), (3,4) }.
  • R ∩ S = ∅.
  • R - S = { (1,2), (2,3) }.
  • R ∘ S = { (2,4) } because (2,3) ∈ R and (3,4) ∈ S.

Properties

  • Operations are closed on the set of relations.
  • Union and intersection are commutative and associative.
  • Composition is associative but generally not commutative.
  • Complement behaves according to De Morgan's laws.

Summary

Relational algebra provides a formal tool for handling relations. Its basic operations allow combining, filtering, and transforming relations, which is of central importance in mathematics and the world of databases.

Practice Exercise

We have reviewed and checked the materials, but errors may still occur. The content is provided for educational purposes only, so use it at your own responsibility and verify with other sources if needed.

✨ Ask Lara — your AI study partner

Unlock personalized learning support. Lara can explain lessons, summarize topics, and answer your study questions — available from the Go plan and above.


Lara helps you learn faster — exclusive to ReadyTools Go, Plus, and Max members.

Track Your Progress 🚀

Learn more easily by tracking your progress completely for free.


Top tools

BoardlyLinksyChromoCodeHub

Select Language

Set theme

© 2025 ReadyTools. All rights reserved.