Which operation returns only rows that appear in both result sets?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which operation returns only rows that appear in both result sets?

Explanation:
Intersection of two result sets is what this topic is about. The operation that returns only rows that appear in both results is the intersection. Using INTERSECT between two SELECT queries yields the rows common to both result sets. In most databases, this returns each row once (no duplicates) unless you use INTERSECT ALL to preserve duplicates when the DB supports it. Other options don’t produce the shared rows: a difference (or minus) shows rows from one set that aren’t in the other, and a join combines rows from tables rather than filtering to the common ones.

Intersection of two result sets is what this topic is about. The operation that returns only rows that appear in both results is the intersection. Using INTERSECT between two SELECT queries yields the rows common to both result sets. In most databases, this returns each row once (no duplicates) unless you use INTERSECT ALL to preserve duplicates when the DB supports it. Other options don’t produce the shared rows: a difference (or minus) shows rows from one set that aren’t in the other, and a join combines rows from tables rather than filtering to the common ones.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy