Mathematical construct.

The cartesian product of any two sets is the set of all ordered pairs where the first member of the pair is an element of one set, and the second member is an element of the other.

(I suppose I should mention that first elements are always from the same set, and second elements are always from the other set).

If we symbolize the sets as S and T, we can symbolize the cartesian product as S X T.

The cartesian product of n sets is the set of ordered n-tuples of elements of that set.

This can also be derived by picking one set to be the "last" set, forming the cartesian product of all the other sets, and then forming the cartesian product of the result with the last set.

The cartesian product of classes is constructed the same way as for sets, except, of course, that the result is a class.

Classes: A x B = { [[a,b],a] | a e A & b e B }

In SQL, a "Cartesian product" refers more specifically to a result set which contains all the permutations of rows of Table A with rows of Table B (and Table C, etc...).

If the result set of your SQL query returns far more rows than anticipated (more even than any of your source tables have), check your join conditions; chances are you've inadvertently created a Cartesian product.

Log in or register to write something here or to contact authors.