SQL - Set OperationsWhich of the following correctly demonstrates how to combine two SELECT statements using UNION in SQL?ASELECT column1 FROM table1 UNION table2;BSELECT column1 FROM table1 UNION SELECT column1 FROM table2;CSELECT column1 FROM table1 AND SELECT column1 FROM table2;DSELECT column1 FROM table1 JOIN SELECT column1 FROM table2;Check Answer
Step-by-Step SolutionSolution:Step 1: Understand UNION syntaxThe UNION operator combines the results of two SELECT statements.Step 2: Check correct syntaxEach SELECT must be complete and separated by UNION keyword.Final Answer:SELECT column1 FROM table1 UNION SELECT column1 FROM table2; -> Option BQuick Check:Both SELECTs are complete and combined correctly [OK]Quick Trick: Each SELECT must be complete before UNION [OK]Common Mistakes:MISTAKESOmitting SELECT in second queryUsing AND or JOIN instead of UNIONNot separating queries properly
Master "Set Operations" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Aggregate Functions - AVG function - Quiz 2easy GROUP BY and HAVING - GROUP BY single column - Quiz 5medium GROUP BY and HAVING - GROUP BY single column - Quiz 4medium INNER JOIN - INNER JOIN syntax - Quiz 8hard LEFT and RIGHT JOIN - Why outer joins are needed - Quiz 15hard LEFT and RIGHT JOIN - Finding unmatched rows with LEFT JOIN - Quiz 15hard Set Operations - UNION ALL with duplicates - Quiz 11easy Subqueries - Subquery in FROM clause (derived table) - Quiz 11easy Views - Updatable views and limitations - Quiz 10hard Views - Dropping and altering views - Quiz 1easy