Thursday, 1 November 2012

Understanding Set Operators in Oracle SQL/PLSQL-Part02

Now lets see what is Intersect and Minus operator. For that we will insert new value in TableA
SQL> insert into Table_A values(19,5,'mulund6','SADF');
1 row created.
SQL> select * from Table_A;
  ORDERNO    CUSTNO CUSADD     CUSNAME
--------- --------- ---------- ---------------
       12         1 mulund     mich
       13         2 mulund1    michl
       14         3 mulund3    michle
       15         4 mulund4    michlen
       19         5 mulund6    SADF 
SQL> select * from Table_B;
    ORDNO    ITEMNO ITEMNAME         QTY
--------- --------- ---------- ---------
       12        67 nut              100
       13        77 nut1             200
       14        87 nut2             300
       15        97 nut3             400
       16       107 nut4             500  
Note :The intersect operator gives only the common values.  The minus operator returns all distinct rows of the first query but not of the second query.

No comments:

Post a Comment