Daten in SQL verbinden (JOIN)
Maham Faisal Khan
Senior Content Developer, DataCamp
CROSS JOIN
erstellt alle möglichen Kombinationen aus zwei Tabellen.
SELECT id1, id2
FROM table1
CROSS JOIN table2;
SELECT prime_minister, president FROM prime_ministers AS p1 CROSS JOIN presidents AS p2
WHERE p1.continent IN ('Asia') AND p2.continent IN ('South America');
|--------------------|-------------------------|
| prime_minister | president |
|--------------------|-------------------------|
| Shehbaz Sharif | Luis Lacalle Pou |
| Narendra Modi | Luis Lacalle Pou |
| Hassanal Bolkiah | Luis Lacalle Pou |
| Haitham bin Tarik | Luis Lacalle Pou |
| Shehbaz Sharif | Gabriel Boric |
| Narendra Modi | Gabriel Boric |
| Hassanal Bolkiah | Gabriel Boric |
| Haitham bin Tarik | Gabriel Boric |
|--------------------|-------------------------|
Daten in SQL verbinden (JOIN)