SQL Joining added the table horizontally whereas set operator joining the table vertically. There are four type of set operator named as except, intersect, union and outer union. Three of the four set operators (EXCEPT, INTERSECT, and UNION) combine columns by overlaying them. (The set operator OUTER UNION does not overlay columns.) By default, the set operators EXCEPT, INTERSECT, and UNION overlay columns based on the relative position of the columns in the SELECT clause. A single SELECT statement can contain multiple set operations. Regardless of the number of set operations in a SELECT statement, the statement contains only one semicolon, which is placed after the last group of query clauses.
Syntax
PROC SQL;
SELECT column-1 <….. column-n>
FROM table-1 | view-1 … table-n | view-n>
<optional query clauses>
set-operator <all > <corr>
SELECT column-1 <….. column-n>
FROM table-1 | view-1 … table-n | view-n>
<optional query clauses> ; /* in last clause giving semicolon */
Quit;
Outer union set operator only not overlaying it is equivalent to concatenation in normal SAS. In order to be overlaid, columns must have the same data type if not it is not fulfill the definition of set operator.
Top SQL Online Training Center in India
Durga Online Trainer is a best SQL Course Trainer in India. Contact us today for learn SQL Online Classes from Durga Online Training Institute in India.
You can join also online classes-