Bird
0
0

In a self join, why do we use table aliases like e1 and e2?

easy📝 Conceptual Q2 of 15
PostgreSQL - Joins in PostgreSQL
In a self join, why do we use table aliases like e1 and e2?
ATo distinguish between the two instances of the same table
BTo create new tables automatically
CTo speed up the query execution
DTo avoid using WHERE clause
Step-by-Step Solution
Solution:
  1. Step 1: Recognize table alias purpose

    Aliases let us treat the same table as two separate entities in the query.
  2. Step 2: Understand necessity in self join

    Without aliases, the database cannot differentiate which instance of the table each column belongs to.
  3. Final Answer:

    To distinguish between the two instances of the same table -> Option A
  4. Quick Check:

    Aliases in self join = Distinguish tables [OK]
Quick Trick: Use aliases to name table copies in self join [OK]
Common Mistakes:
  • Thinking aliases create new tables
  • Assuming aliases improve speed
  • Believing aliases remove WHERE clause need

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes