google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: Assignment in SQL for use of set operator

Monday, February 11, 2019

Assignment in SQL for use of set operator


Assignment:-               

Assign. Name:- In SQL Use of SET Operator.

CLASS:-T.Y.B.Sc(Computer)          

*************************************************************

Use of SET Operator:
- UNION
- INTERSECT
- IN
- NOT IN

SQL>select * from borrower;

 CUST_NAME                 LOAN_NO
---------------------    -------------
Samir                            1
Mahesh                         2
Smita                            3
Vrushali                         4
Devendra                       5
Vaibhav                         6

UNION:-
SQL> (select cust_name from borrower) UNION
     (select cust_name from depositer);
 CUST_NAME
-----------------------
 Devendra
 Mahesh
 Samir
 Smita
 Vaibhav
 Vrushali
  6 rows selected.
SQL> (Select cust_name from borrower) UNION ALL
     (Select cust_name from depositer);

    CUST_NAME
---------------------------------
    Samir
    Mahesh
    Smita
    Vrushali
    Devendra
    Vaibhav
    Samir
    Mahesh
    Samita
    Vrushali
    Devendra   

    

11 row selected.

INTERSECT:-

SQL> (Select cust_name from borrower) INTERSECT
     (Select cust_name from depositer);

    CUST_NAME
  ----------------------------
    Devendra
    Mahesh
    Samir
    Smita
    Vrushali

 IN:-

SQL> Select DISTINCT cust_name from borrower WHERE
     cust_name IN (Select cust_name from depositer);

    CUST_NAME
       ------------------------
    Devendra
    Mahesh
    Samir
    Smita
    Vrushali

 NOT IN:-

SQL> Select DISTINCT cust_name from borrower WHERE
     cust_name NOT IN (Select cust_name from depositer);

    CUST_NAME
    ----------------------
    Vaibhav
   

No comments:

Post a Comment

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...