Jump to content

Hash join: Difference between revisions

Made SQL produce similar output to the other languages
(Added SQL implementation)
(Made SQL produce similar output to the other languages)
Line 850:
insert into nemesises (name, nemesis) values ('Glory', 'Buffy');</lang>
 
Doing the join is concise. But we don't actually have control over how the join is implemented, so this might not actually be a hash join...
<lang sql>select distinct* from people p join nemesises n on p.name = n.name</lang>
p.name,
n.nemesis
from
people p
join nemesises n on p.name=n.name
order by
p.name</lang>
 
{{out}}
<pre> AGE NAME NAME NEMESIS
---------- ---------------- ---------------- ----------------
Alan 27 Jonah Ghosts Jonah Whales
Alan 27 Jonah Zombies Jonah Spiders
Glory 28 Alan Buffy Alan Ghosts
Jonah 18 Alan Spiders Alan Ghosts
Jonah 28 Alan Whales</pre> Alan Zombies
18 Alan Alan Zombies
28 Glory Glory Buffy</pre>
 
=={{header|Tcl}}==
Tcl uses hash tables to implement both its associative arrays and its dictionaries.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.