Relational algebra includes a subset of operations derived from set theory, as relations (or tables) in databases are viewed as sets of tuples (rows).
The key set-theoretic operations in relational algebra are:
- Union (∪)
- Intersection (∩)
- Difference (−)
- Cartesian Product (×)
1.) Union (∪):
The Union operation combines the tuples (rows) of two relations. It returns all tuples that are present in either of the two relations, eliminating duplicates.
Conditions:
- Both relations must have the same number of attributes (columns).
- The corresponding attributes must have the same type.

2.) Intersection (∩):
The Intersection operation returns only the tuples that are present in both relations. It retrieves the common elements between the two relations.
Conditions:
- Both relations must have the same number of attributes.
- The corresponding attributes must have the same type.

3.) Difference (−):
The Difference operation returns the tuples that are present in the first relation but not in the second relation. It subtracts the second relation from the first.
Conditions:
- Both relations must have the same number of attributes.
- The corresponding attributes must have the same type.

4.) Cartesian Product (×):
The Cartesian Product operation combines each tuple of one relation with every tuple of another relation. It returns a new relation where every row of the first relation is paired with every row of the second relation, resulting in a relation with all possible combinations of tuples.
