IAE Academy

Relational algebra formulas

The relational model: relational algebra and tuple calculus. 16 formulas for GATE DA Database Management and Warehousing, each with when to use it. Each is explained in the topic notes.

All 16 Relational algebra formulas

SUPERKEY CONDITION

Every superset of a superkey (within the attributes of ) is a superkey, so under set semantics the set of all attributes is always a superkey. Candidate keys are the minimal superkeys.

COUNTING SUPERKEYS

is the number of attributes of . A superkey is any attribute set that contains at least one candidate key. With two keys, inclusion-exclusion subtracts the sets counted twice: those containing .

SELECTION

Keeps whole tuples satisfying the condition; schema unchanged; .

PROJECTION

Keeps the listed columns and removes duplicate rows (set semantics). For non-empty , , with whenever the list contains a superkey.

CARTESIAN PRODUCT

Pairs every tuple of with every tuple of . Clashing attribute names are qualified (, ) or renamed with .

UNION AND SET DIFFERENCE

Defined only for union-compatible relations: the same degree, with the -th attributes of both having the same domain. By convention the result takes its attribute names from the first operand. Union is commutative and associative; difference is neither.

CARDINALITY BOUNDS FOR SET OPERATIONS

Set semantics, and union-compatible. Also and . The upper bounds of and are reached when ; their lower bounds when the smaller relation is contained in the larger.

THETA JOIN

. An equi-join is a theta join whose condition is only equalities; it keeps both copies of the compared attributes.

NATURAL JOIN

are the attributes with the same name in both relations, and the result has degree . With no common attribute it equals ; when the two schemas are identical it equals . A NULL never matches, not even another NULL. Natural join is commutative and associative (up to column order).

INTERSECTION

Union-compatible relations; .

DIVISION

and , where the attributes of are a proper subset of those of and is the rest. The result has schema (degree ): the -values that appear in paired with every tuple of . If is empty, the formula gives .

DIVISION SIZE BOUNDS

Each -value in the result needs its own tuples in , one for each tuple of , and these tuples are different for different -values.

OUTER JOIN COUNTS

is the inner (natural) join; and are the numbers of tuples of and of that match no tuple of the other relation. Left outer adds only , right outer only .

NATURAL JOIN SIZE BOUNDS

If the common attributes form a key of , each tuple of matches at most one tuple of , so . If they are also a foreign key of referencing with no NULL in it, the size is exactly .

LARGEST VALUE WITHOUT AGGREGATION

is a renamed copy of . The subtracted part is every -value that some other value of exceeds, so what remains is the maximum value of . Use in place of for the minimum. This assumes contains no NULL.

TRC EXPRESSION

The result is the set of all tuples for which formula is true. is the only free variable of ; every other tuple variable must be bound by a quantifier.

Where this was asked: 2024 (1), 2025 (2), 2026 (2). See the 5 previous-year questions on Relational algebra. This shows what was asked, not what will be asked.