# Encyclopedia of Database Systems

2018 Edition
| Editors: Ling Liu, M. Tamer Özsu

# Cartesian Product

• Cristina Sirangelo
Reference work entry
DOI: https://doi.org/10.1007/978-1-4614-8265-9_1259

Cross product

## Definition

Given two relation instances R1, over set of attributes U1, and R2, over set of attributes U2 – with U1 and U2 disjoint – the Cartesian product R1 × R2 returns a new relation, over set of attributes U1U2, consisting of tuples {t|t(U1) ∈ R1 and t(U2) ∈ R2}. Here t(U) denotes the restriction of the tuple t to attributes in the set U.

## Key Points

The Cartesian product is an operator of the relational algebra which extends to relations the usual notion of Cartesian product of sets.

Since the sets of attributes of the input relations are disjoint, in R1 × R2, each tuple of R1 is combined with each tuple of R2; moreover the arity of the output relation is the sum of the arities of R1 and R2.

As an example, consider a relation Students over attributes (student-number, student-name), containing tuples {(1001, Black), (1002, White)}, and a relation Courses over attributes (course-number, course-name), containing tuples {(EH1, Databases), (GH5, Logic)}. Then Students...

This is a preview of subscription content, log in to check access.