Skip to main contentSkip to solution

Consider two tables 'A' and 'B'. What does the following query do?

SELECT * FROM A

INTERSECT

SELECT * FROM B;

Solution

✅ Correct Option: 1

INTERSECT returns only the rows that appear in the results of both SELECT statements. Here, it gives the rows of A that also exist in B, with duplicates removed.


Option 2: that is what UNION (or UNION ALL) does, combining the rows of both tables.

Option 4: that is what EXCEPT (MINUS in Oracle) does, returning rows of A that are not in B.

Both queries in an INTERSECT must have the same number of columns with compatible data types.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question