❌ CROSS JOIN in SQL
Last Updated: January 2026
The CROSS JOIN returns the Cartesian Product of two tables. Every row from table A is combined with every row from table B.
If:
- Table A has m rows
- Table B has n rows
Result = m × n rows
Hinglish Tip 🗣: Har row ka har row ke saath combination chahiye →
CROSS JOIN.
🧾 Basic Syntax
SELECT columns
FROM table1
CROSS JOIN table2;
Notes:
- No
ONcondition - No matching logic
📄 Example Tables
colors
| color |
|---|
| Red |
| Blue |
sizes
| size |
|---|
| S |
| M |
| L |
📄 CROSS JOIN Example
SELECT c.color, s.size
FROM colors c
CROSS JOIN sizes s;
✅ Result
| color | size |
|---|---|
| Red | S |
| Red | M |
| Red | L |
| Blue | S |
| Blue | M |
| Blue | L |
Total rows = 2 × 3 = 6
⚠️ DANGER: Use Carefully
- Large tables → huge result
- Performance issues
- Memory explosion