SQL - INNER JOINWhat is the main purpose of a self join in SQL?ATo combine rows from two tables without any conditionBTo join two different tables based on a common columnCTo join a table to itself to compare rows within the same tableDTo delete duplicate rows from a tableCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the concept of self joinA self join is used when you want to compare rows within the same table by treating it as two separate tables using aliases.Step 2: Identify the correct purposeJoining a table to itself allows you to find relationships or comparisons between rows in the same table, such as hierarchical data or pairs.Final Answer:To join a table to itself to compare rows within the same table -> Option CQuick Check:Self join = join table to itself [OK]Quick Trick: Self join means joining table to itself using aliases [OK]Common Mistakes:MISTAKESConfusing self join with joining two different tablesThinking self join deletes duplicatesAssuming self join combines rows without condition
Master "INNER JOIN" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Aggregate Functions - COUNT(*) vs COUNT(column) difference - Quiz 13medium Aggregate Functions - MIN and MAX functions - Quiz 9hard GROUP BY and HAVING - GROUP BY with ORDER BY - Quiz 8hard LEFT and RIGHT JOIN - Multiple LEFT JOINs in one query - Quiz 1easy Set Operations - Set operations with ORDER BY - Quiz 12easy Subqueries - Subquery in FROM clause (derived table) - Quiz 13medium Subqueries - Why subqueries are needed - Quiz 5medium Subqueries - Subquery vs JOIN performance trade-off - Quiz 6medium Table Constraints - Foreign key ON UPDATE behavior - Quiz 10hard Table Constraints - Foreign key ON UPDATE behavior - Quiz 3easy