What is a cartesian product?
A cartesian product is every possible combination of rows between two tables.
If the first table has 10 rows and the second has 5, the result is 10 × 5 = 50 rows. Every row of the first table pairs with every row of the second, regardless of logic or matching data.
In SQL this comes from CROSS JOIN or from mistakenly using JOIN without an ON condition.
Example
products (3 rows) × colors (2 rows)
-> the result is 6 rows, where every product is represented in every color.
This technique is often used deliberately to generate all possible combinations - for example, sizes, dates, parameters, or test data.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.