SET OPERATORS
Set operators are used to join the records of 2/more
tables.
Union:
Displays unique values from both tables.In unique all
selected columns need to be same datatype.
SELECT * FROM T1 UNION
SELECT * FROM T2
Intersect:
Displays similar values existing in both tables
SELECT * FROM T1
INTERSECT
SELECT * FROM T2
Except:
Displays distinct values from first table which are not present in second table.
SELECT * FROM T1
EXCEPT
SELECT * FROM T2
Union All:
It selects all values i.e including duplicate values
UNION ALL
SELECT * FROM T2
nice explanation very informative ... Thanks for posting this Article
ReplyDeleteWelcome.
ReplyDelete