Hash join: Difference between revisions
Content added Content deleted
(added python) |
|||
Line 258: | Line 258: | ||
return result |
return result |
||
table1 = [( |
table1 = [(27, "Jonah"), |
||
( |
(18, "Alan"), |
||
( |
(28, "Glory"), |
||
( |
(18, "Popeye"), |
||
(28, "Alan")] |
|||
table2 = [("Jonah", "Whales"), |
table2 = [("Jonah", "Whales"), |
||
("Jonah", "Spiders"), |
("Jonah", "Spiders"), |
||
("Alan", "Ghosts"), |
("Alan", "Ghosts"), |
||
("Alan", "Zombies"), |
("Alan", "Zombies"), |
||
("Glory", "Buffy")] |
("Glory", "Buffy")] |
||
for row in hashJoin(table1, table2): |
for row in hashJoin(table1, table2): |
||
Line 272: | Line 273: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
(( |
((27, 'Jonah'), ('Jonah', 'Whales')) |
||
(( |
((27, 'Jonah'), ('Jonah', 'Spiders')) |
||
(( |
((18, 'Alan'), ('Alan', 'Ghosts')) |
||
(( |
((28, 'Alan'), ('Alan', 'Ghosts')) |
||
(( |
((18, 'Alan'), ('Alan', 'Zombies')) |
||
((28, 'Alan'), ('Alan', 'Zombies')) |
|||
((28, 'Glory'), ('Glory', 'Buffy')) |
|||
</pre> |
</pre> |
||