Set Operation
Set Operation
For Example :
Create two tables with the same column name and data type.
-----------------------------------------------------------------------------------------------------------------------------------------------------
Subject : DBMS Class : SE SEM: IV Dr.Anirudh Mangore
Chapter : 4
Structured Query Language (SQL)
-----------------------------------------------------------------------------------------------------------------------------------------
UNION Operation
UNION is used to combine the results of two or more SELECT statements. However
it will eliminate duplicate rows from its resultset. In case of union, number of
columns and datatype must be same in both the tables, on which UNION operation
is being applied.
UNION
UNION ALL
This operation is similar to Union. But it also shows the duplicate rows.
SELECT Name,TotalMark FROM students2000
UNION ALL
-----------------------------------------------------------------------------------------------------------------------------------------------------
Subject : DBMS Class : SE SEM: IV Dr.Anirudh Mangore
Chapter : 4
Structured Query Language (SQL)
-----------------------------------------------------------------------------------------------------------------------------------------
INTERSECT
Intersect operation is used to combine two SELECT statements, but it only retuns the records
which are common from both SELECT statements.
INTERSECT
EXCEPT
The EXCEPToperation combines results of two SELECT statements and return only those in the
final result, which belongs to the first set of the result.
EXCEPT clause in SQL Server is working as like MINUS operation in Oracle.
EXCEPT returns any distinct values from the left select query that are not also found on
the right select query.
EXCEPT
-----------------------------------------------------------------------------------------------------------------------------------------------------
Subject : DBMS Class : SE SEM: IV Dr.Anirudh Mangore