Bird
0
0

What is the main purpose of a self join in SQL?

easy📝 Conceptual Q11 of 15
SQL - INNER JOIN
What is the main purpose of a self join in SQL?
ATo combine rows from two tables without any condition
BTo join two different tables based on a common column
CTo join a table to itself to compare rows within the same table
DTo delete duplicate rows from a table
Step-by-Step Solution
Solution:
  1. Step 1: Understand the concept of self join

    A self join is used when you want to compare rows within the same table by treating it as two separate tables using aliases.
  2. Step 2: Identify the correct purpose

    Joining a table to itself allows you to find relationships or comparisons between rows in the same table, such as hierarchical data or pairs.
  3. Final Answer:

    To join a table to itself to compare rows within the same table -> Option C
  4. Quick Check:

    Self join = join table to itself [OK]
Quick Trick: Self join means joining table to itself using aliases [OK]
Common Mistakes:
MISTAKES
  • Confusing self join with joining two different tables
  • Thinking self join deletes duplicates
  • Assuming self join combines rows without condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes