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
hasm
rows andTable B
hasn
rows, the result will havem ร 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.
Leave a Reply