Difficulty: Easy
Correct Answer: Equi-join
Explanation:
Introduction:
Most day-to-day reporting and OLTP queries need rows that match on a key in both tables. Knowing which join type expresses this intent ensures predictable results and good performance with proper indexing.
Given Data / Assumptions:
Concept / Approach:
An inner join returns only rows that satisfy the join condition. An equi-join is the most common inner join, using equality conditions such as T1.key = T2.key. A natural join is also an inner join but automatically uses all identically named columns, which can be risky. In contrast, outer joins are chosen when you need to retain non-matching rows from one or both sides.
Step-by-Step Solution:
Identify the matching key(s) across the two tables.Write an inner equi-join using explicit ON clauses for clarity.Confirm that only rows meeting the equality condition are returned.Avoid outer joins here because they preserve non-matching rows.
Verification / Alternative check:
Compare an INNER JOIN to a LEFT OUTER JOIN on the same data; the inner join will have fewer or equal rows because it filters out non-matching records.
Why Other Options Are Wrong:
Common Pitfalls:
Using NATURAL JOIN and accidentally joining on unintended columns with the same name. Prefer explicit equi-joins with ON clauses.
Final Answer:
Equi-join
Discussion & Comments