Difference between revisions of "Cartesian Join or Cross Join"

From rbachwiki
Jump to navigation Jump to search
 
Line 6: Line 6:
'''matched with each of the four records in the second table. Then the second record of the'''
'''matched with each of the four records in the second table. Then the second record of the'''
'''first table is matched with each of the four records from the second table, and so on.'''
'''first table is matched with each of the four records from the second table, and so on.'''
'''IF YOU CROSS JOIN A TABLE WITH 20 ROWS WITH A TABLE WITH 100 ROWS, THE QUERY WILL RETURN 2000 ROWS'''


  SELECT isbn, title, location, ' ' Count
  SELECT isbn, title, location, ' ' Count

Latest revision as of 00:50, 25 October 2017

In a Cartesian join, also called a Cartesian product or cross join, each record in the first table is matched with each record in the second table. This type of join is useful when you’re performing certain statistical procedures for data analysis. Therefore, if you have three records in the first table and four in the second table, the first record from the first table is matched with each of the four records in the second table. Then the second record of the first table is matched with each of the four records from the second table, and so on. IF YOU CROSS JOIN A TABLE WITH 20 ROWS WITH A TABLE WITH 100 ROWS, THE QUERY WILL RETURN 2000 ROWS

SELECT isbn, title, location, ' ' Count
FROM books, warehouses
ORDER BY location, title;
SELECT isbn, title, location, ' ' Count
FROM books CROSS JOIN warehouses
ORDER BY location, title;

Back To Top- Home - Category