0
0
DBMS Theoryknowledge~5 mins

Join algorithms (nested loop, sort-merge, hash join) in DBMS Theory - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Nested Loop Join in database systems?
A Nested Loop Join compares each row of one table with every row of another table to find matching pairs. It is simple but can be slow for large tables.
Click to reveal answer
intermediate
How does a Sort-Merge Join work?
Sort-Merge Join first sorts both tables on the join key, then merges them by scanning through both sorted lists to find matching rows efficiently.
Click to reveal answer
intermediate
What is the main idea behind a Hash Join?
Hash Join builds a hash table on the smaller table using the join key, then scans the larger table to find matches by looking up the hash table, making it fast for large data.
Click to reveal answer
beginner
Which join algorithm is generally best for small tables?
Nested Loop Join is often best for small tables because it is simple and does not require sorting or hashing.
Click to reveal answer
intermediate
Why is Sort-Merge Join efficient for already sorted data?
Because it can merge the two sorted tables in a single pass without extra sorting, reducing the time needed to find matching rows.
Click to reveal answer
Which join algorithm compares every row of one table with every row of another?
AIndex Join
BSort-Merge Join
CNested Loop Join
DHash Join
What is the first step in a Sort-Merge Join?
ASort both tables on the join key
BBuild a hash table
CScan the larger table
DCompare each row pair
Hash Join is most efficient when:
ABoth tables are very small
BOne table is much smaller than the other
CBoth tables are already sorted
DTables have no indexes
Which join algorithm requires sorting the tables?
ASort-Merge Join
BHash Join
CNested Loop Join
DCartesian Join
Which join algorithm is simplest but can be slow for large tables?
AHash Join
BSort-Merge Join
CIndex Join
DNested Loop Join
Explain how a Hash Join works and why it is efficient for large tables.
Think about dividing work between small and large tables using a hash.
You got /4 concepts.
    Compare Nested Loop Join and Sort-Merge Join in terms of when each is best used.
    Consider table size and sorting when choosing the join.
    You got /4 concepts.