Relational division expresses an all-required-matches query. Let be a database relation, the required values and an explicit candidate database relation. The desired result is
It can be constructed using Cartesian product, relational projection and relational difference:
The inner relational difference contains missing required pairs. Its relational projection identifies failing candidates; removing them from proves the formula.
For example, can record scientific instrument/test pairs and the required tests. An scientific instrument with both pairs passes; one with only the heat pair does not. This is a universal quantifier requirement, unlike an ordinary relational join asking for some match.
When is empty, vacuous truth gives . Choosing is conventional but cannot recover candidates absent from ; use an independently stored scientific instrument database relation if those candidates must be included. Stating the candidate universe makes this edge case unambiguous.
For two database relations with compatible database attributes, retains the database tuples in the first and absent from the second.
Combines database tuples satisfying a matching condition. A natural join uses equality of all shared database attribute names.
A natural join combines two database relations by equating every identically named attribute and retaining one copy of each common attribute. If people(id,name) contains (7,Ada) and scores(id,mark) contains (7,90), their natural join contains (7,Ada,90). With no common names it becomes a Cartesian product. Matching several common columns requires all their equalities, so adding a same-named column can silently change the result. An explicit join condition is often clearer when schemas evolve. In SQL, duplicates and null values follow the implementation's join semantics.[ref]
Retains specified database attributes, eliminating repeated database tuples under set semantics.
Retains the database tuples satisfying a condition.

Articles by others on the same topic (1)

Relational algebra is a formal system for manipulating and querying relational data, which is organized into tables (or relations). It provides a set of operations that can be applied to these tables to retrieve, combine, and transform data in various ways. Relational algebra serves as the theoretical foundation for relational databases and query languages like SQL.