What is a cross join and how does it differ from inner join?

SQL
Medium
76.3K views

This question tests Cartesian product knowledge. It evaluates combinatorial logic.

Why Interviewers Ask This

Cross joins create massive datasets. Interviewers check if you understand the explosion risk and intentional use cases.

How to Answer This Question

Define cross join as Cartesian product (every pair). Contrast with inner join which filters by condition. Mention use cases like generating combinations.

Key Points to Cover

  • Cartesian product
  • No join condition
  • Result size multiplication
  • Intentional combinations

Sample Answer

A CROSS JOIN returns the cartesian product of two tables, pairing every row from A with every row from B. The result size is rows(A) multiplied by rows(B). Unlike INNER JOIN, it doesn't use a join condition and is used for generating all possible combinations.

Common Mistakes to Avoid

  • Accidentally creating cross joins
  • Confusing with outer joins
  • Ignoring performance risks

Practice This Question with AI

Answer this question orally or via text and get instant AI-powered feedback on your response quality, structure, and delivery.

Start Practicing

Related Interview Questions

Browse all 49 SQL questions