Skip to main contentSkip to solution

Table 1

FirstNameLastName
JohnSmith
BobDylan
AliceSomers
JacobHobbs

Table 2

FirstNameLastName
JohnSmith
BobDylan
AliceSomers

What does the Cartesian product of the two tables represent in SQL?

Solution

✅ Correct Option: 4

The Cartesian product pairs every row of Table 1 with every row of Table 2, so the number of rows in the result is the product of the two row counts.

Table 1 has 4 rows and Table 2 has 3 rows, so the result has 4×3=124 \times 3 = \boxed{12} rows.


Options 1 and 2: INTERSECTION and UNION keep rows as they are (common rows, or all rows stacked), while a Cartesian product joins rows from both tables side by side.


We believe the answer could be Option 3, since it directly describes the Cartesian product (each row of Table 1 combined with all rows of Table 2), while Option 4 only gives the row count of the result. However, NTA's final answer key (after all challenges) says Option 4.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question