Bird
0
0

What is the primary benefit of using a self join on a table like employees?

easy📝 Conceptual Q1 of 15
PostgreSQL - Joins in PostgreSQL
What is the primary benefit of using a self join on a table like employees?
ATo join two different tables with similar structures
BTo compare rows within the same table based on related columns
CTo create a backup of the table
DTo delete duplicate rows from the table
Step-by-Step Solution
Solution:
  1. Step 1: Understand self join

    A self join allows a table to be joined with itself, enabling comparison between rows.
  2. Step 2: Purpose in employees table

    In the employees table, it helps relate employees to their managers or peers by comparing rows.
  3. Final Answer:

    To compare rows within the same table based on related columns -> Option B
  4. Quick Check:

    Self join compares rows in one table [OK]
Quick Trick: Self join compares rows within the same table [OK]
Common Mistakes:
  • Confusing self join with joining two different tables
  • Thinking self join duplicates data
  • Assuming self join is used for deleting rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes