Cross Join

A cross join produces the Cartesian product of two tables, returning all possible combinations of rows from both tables.

Explanation:

  • No condition is needed for a cross join.
  • If Table A has m rows and Table B has n rows, the result will have m ร— n rows.

Example SQL Cross Join:

sqlCopyEditSELECT A.name, B.course_name
FROM Students A
CROSS JOIN Courses B;

This returns every student paired with every course.