Bird
0
0

Which of the following is the correct syntax to find common rows between two tables Table1 and Table2?

easy📝 Syntax Q3 of 15
SQL - Set Operations
Which of the following is the correct syntax to find common rows between two tables Table1 and Table2?
ASELECT * FROM Table1 JOIN Table2;
BSELECT * FROM Table1 UNION SELECT * FROM Table2;
CSELECT * FROM Table1 EXCEPT SELECT * FROM Table2;
DSELECT * FROM Table1 INTERSECT SELECT * FROM Table2;
Step-by-Step Solution
Solution:
  1. Step 1: Review syntax for INTERSECT

    The correct syntax uses SELECT * FROM Table1 INTERSECT SELECT * FROM Table2 to get common rows.
  2. Step 2: Eliminate incorrect options

    UNION combines all rows, JOIN requires ON clause, EXCEPT returns rows only in first table.
  3. Final Answer:

    SELECT * FROM Table1 INTERSECT SELECT * FROM Table2; -> Option D
  4. Quick Check:

    Correct INTERSECT syntax = SELECT * FROM Table1 INTERSECT SELECT * FROM Table2; [OK]
Quick Trick: Use INTERSECT between two SELECT queries for common rows [OK]
Common Mistakes:
MISTAKES
  • Using UNION instead of INTERSECT
  • Writing JOIN without ON clause
  • Using EXCEPT to find common rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes