0% found this document useful (0 votes)
31 views

Set Operators

This document discusses SQL set operators including UNION, UNION ALL, INTERSECT, and MINUS. It provides examples of how each operator combines the results of two SELECT statements on tables T1 and T2, returning either all unique rows, all rows with duplicates, common rows between the tables, or rows only in the first/second table. The document was prepared by AN.Murugappan to explain these SQL set operators.

Uploaded by

Senthil Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Set Operators

This document discusses SQL set operators including UNION, UNION ALL, INTERSECT, and MINUS. It provides examples of how each operator combines the results of two SELECT statements on tables T1 and T2, returning either all unique rows, all rows with duplicates, common rows between the tables, or rows only in the first/second table. The document was prepared by AN.Murugappan to explain these SQL set operators.

Uploaded by

Senthil Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SET OPERATORS

UNION - UNION ALL INTERECT - MINUS

Document prepared by: AN.Murugappan

UNION UNION ALL INTERECT MINUS

SELECT * FROM T1; 1234 SELECT * FROM T2; 1235 SELECT * FROM T1 UNION SELECT * FROM T2; 12345

SELECT * FROM T1 UNION ALL SELECT * FROM T2; 12341235

SELECT * FROM T1 INTERSECT SELECT * FROM T2; 123

SELECT * FROM T1

MINUS SELECT * FROM T2; 4

SELECT * FROM T2 MINUS SELECT * FROM T1; 5 SELECT * FROM T1 MINUS SELECT * FROM T2 UNION (SELECT * FROM T2 MINUS SELECT * FROM T1) 45

You might also like