This section of Slick's documentation page is quite odd.
What is this zip join? It says that it means:
a pairwise join of two queries
but what that means @.@ I don't know
I've tried Googling for both "zip join" and "pairwise join"... but no results to do with databases.
I do get this from Wikipedia when I search on "pairwise" though...
Could somebody give me some examples illustrating the differences between a zip join and a normal outer or inner join? Thanks!
What Does Join Mean? A join is an SQL operation performed to establish a connection between two or more database tables based on matching columns, thereby creating a relationship between the tables. Most complex queries in an SQL database management system involve join commands.
When to Use RIGHT JOIN. The RIGHT OUTER JOIN is used when you want to join records from tables, and you want to return all the rows from one table and show the other tables columns if there is a match else return NULL values.
Zip joins are only meaningful when talking about ordered sets. Instead of joining based on the value of a column, you are joining based on the row number.
Table1
[λ] [color]
400 violet
415 indigo
475 blue
510 green
570 yellow
590 orange
650 red
Table2
[flame] [element]
green boron
yellow sodium
white magnesium
red calcium
blue indium
Table1 INNER JOIN Table2 ON [color] = [flame] : only matching rows
[λ] [color] [flame] [element]
475 blue blue indium
510 green green boron
570 yellow yellow sodium
650 red red calcium
Table1 OUTER JOIN Table2 ON [color] = [flame] : all rows, matched where possible
[λ] [color] [flame] [element]
400 violet NULL NULL
415 indigo NULL NULL
475 blue blue indium
510 green green boron
570 yellow yellow sodium
590 orange NULL NULL
650 red red calcium
NULL NULL white magnesium
Table1 "zip joined" to Table2 : all rows, regardless of match
[λ] [color] [flame] [element]
400 violet green boron
415 indigo yellow sodium
475 blue white magnesium
510 green red calcium
570 yellow blue indium
590 orange NULL NULL
650 red NULL NULL
Zip joins are combining the data like a zipper, pairing the first row from one table with the first row from the other, second paired with second, etc. It's not actually looking at that data. They can be generated very quickly, but they won't mean anything unless there is some meaningful order already present in your data or if you just want to generate random pairings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With