SQL - Set OperationsWhich of the following is the correct syntax to combine two SELECT queries using UNION in SQL?AUNION SELECT * FROM table1, SELECT * FROM table2;BSELECT * FROM table1 JOIN UNION SELECT * FROM table2;CSELECT * FROM table1 UNION SELECT * FROM table2;DSELECT * FROM table1 AND SELECT * FROM table2 UNION;Check Answer
Step-by-Step SolutionSolution:Step 1: Recall correct UNION syntaxThe correct syntax is to write one SELECT query, then UNION, then another SELECT query.Step 2: Check each option for syntax errorsSELECT * FROM table1 UNION SELECT * FROM table2; follows the correct syntax. Options A, B, and D have incorrect keywords or order.Final Answer:SELECT * FROM table1 UNION SELECT * FROM table2; -> Option CQuick Check:Correct UNION syntax = SELECT * FROM table1 UNION SELECT * FROM table2; [OK]Quick Trick: UNION joins two SELECT queries directly [OK]Common Mistakes:MISTAKESAdding JOIN keyword with UNIONUsing commas instead of UNIONPlacing UNION at the end incorrectly
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