From the course: Advanced SQL: High Performance Relational Divisions

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Cartesian product

Cartesian product - SQL Tutorial

From the course: Advanced SQL: High Performance Relational Divisions

Start my 1-month free trial

Cartesian product

- [Instructor] A Cartesian product of two relations, R and S is symbolized as R multiplied by S. It returns all combinations of every tuple in R with every tuple in S. In sequel, it is called the cross join. And it's best explained with an example. Here are two relations representing legendary chess players from the USA and Russia. And yes, I'm fully aware that some of these players are not from the same eras and there's no way they could have played each other, regardless, it is my course, so I can do whatever I want. We are organizing a tournament between these teams and we need to match every USA player with every Russian player called "Shakhmatist" in Russia. The word chess comes from the Sanskrit word, "chaturanga." It means four arms representing the four members of the Indian Army. Elephants, horses, chariots and foot soldiers. Around 600 AD, it was introduced in Persia where the King which was "Rajah" in Sanskrit, was…

Contents