11.SQL Queries-Set Operators
11.SQL Queries-Set Operators
SET Operators :
• Set operators are used to join the results of two (or
more) SELECT statements.
• The SET operators available in Oracle are
UNION,UNION ALL,INTERSECT,and MINUS.
• Same number of columns must be selected by all
participating SELECT statements.Column names used in
the display are taken from the first query.
• Data types of the column list must be
compatible/implicitly convertible by oracle. Oracle will
not perform implicit type conversion if corresponding
columns in the component queries belong to different
data type groups.
• Positional ordering must be used to sort the result
set. Individual result set ordering is not allowed
with Set operators. ORDER BY can appear once at
the end of the query.
• UNION and INTERSECT operators are commutative,
i.e. the order of queries is not important; it doesn't
change the final result.
• Set operators can be the part of sub queries.
• Consider tables: