SQL - SubqueriesWhich of the following is the correct syntax to use EXISTS in a WHERE clause?ASELECT * FROM table WHERE EXISTS (SELECT column FROM table2);BSELECT * FROM table WHERE EXISTS = (SELECT column FROM table2);CSELECT * FROM table WHERE EXISTS IN (SELECT column FROM table2);DSELECT * FROM table WHERE EXISTS LIKE (SELECT column FROM table2);Check Answer
Step-by-Step SolutionSolution:Step 1: Review correct EXISTS syntaxEXISTS is used as EXISTS (subquery) without any operator like =, IN, or LIKE.Step 2: Identify incorrect optionsOptions B, C, and D misuse operators (=, IN, LIKE) with EXISTS, causing syntax errors.Final Answer:SELECT * FROM table WHERE EXISTS (SELECT column FROM table2); -> Option AQuick Check:EXISTS uses only parentheses for subquery [OK]Quick Trick: EXISTS always followed by (subquery) without operators [OK]Common Mistakes:MISTAKESAdding = or IN after EXISTSUsing LIKE with EXISTSForgetting parentheses around subquery
Master "Subqueries" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Joins - FULL OUTER JOIN behavior - Quiz 13medium Advanced Joins - CROSS JOIN cartesian product - Quiz 6medium Advanced Joins - FULL OUTER JOIN behavior - Quiz 9hard GROUP BY and HAVING - GROUP BY with NULL values behavior - Quiz 11easy GROUP BY and HAVING - Why grouping is needed - Quiz 4medium INNER JOIN - INNER JOIN with multiple conditions - Quiz 7medium INNER JOIN - INNER JOIN with multiple conditions - Quiz 12easy LEFT and RIGHT JOIN - Finding unmatched rows with LEFT JOIN - Quiz 10hard Subqueries - Subquery vs JOIN performance trade-off - Quiz 15hard Table Relationships - Why understanding relationships matters - Quiz 1easy