Page 204 - Informatics_Practices_Fliipbook_Class12
P. 204

Once a tuple is stored in the EMPLOYEE table having ID value 10007, we can update the table DEPARTMENT to
        set  Mgr_Id  equal to 10007 using the following UPDATE statement.

        UPDATE DEPARTMENT
        SET Mgr_Id = 10007
        WHERE Dept_No = 5;
        The above UPDATE statement finds a tuple in the DEPARTMENT table having Dept_No equal to 5 and sets the value
        of its Mgr_Id attribute to 10007. Table 5.2 shows the updated DEPARTMENT table.

                             Dept_No      Dept_Name          Location           Mgr_Id

                                 1         Accounts           Noida              NULL
                                 2       Administration        Delhi             NULL
                                 3        Home Goods         Mumbai              NULL
                                 4        Automobile        Jamshedpur           NULL
                                 5          Textile          Mumbai              10007

                      Table 5.2: DEPARTMENT table after updating the Mgr_Id to 10007 for Dept_No = 5
        On inserting the required data, the current state of the EMPLOYEE and DEPARTMENT tables are shown in Tables 5.3
        and 5.4, respectively.


                                                                             Pin_                          Dept_
           ID    FName      LName    Gender       Address          City                 DOB       Salary
                                                                             Code                           No
         10001     Raj      Reddy       M     West Godavari      Andhra     534197   1980-06-13  100000      2
                                                                 Pradesh

         10002    Dhiraj     Bora       M     Dispur, Kamrup,   Guwahati    781005   1975-09-30  85000       1
                                              Assam

         10003   Muskan     Taneja      F     8/33, Geeta         Delhi     110031   1990-01-25  100000      2
                                              Colony

         10004    Hiten     Oberoi      M     15, Dimna Road,  Jamshedpur 831018     1985-06-24  100000      4
                                              Mango

         10005   Anshul     Verma       M     House 10, Sector    Noida     201304   1990-01-01  100000      1
                                              16, Gautam Budh
                                              Nagar
         10006    Rajit     Gadh        F     12, Beldih       Jamshedpur 831001     1960-05-07  60000       4
                                              Triangle, Bistupur
         10007    Taran     Adarsh      M     B-76, CST Road,    Mumbai     400098   1965-01-13  70000       5
                                              Kalina, Santacruz
                                              East
         10008    Naval    Dhingra      M     E-14 Vivek Vihar    Delhi     110095   1975-08-04  70000       2
         10009   Naveen     Basra       F     28, Aambagan     Jamshedpur 831001     1980-09-24  60000       4
                                              Road, Sakechi
         10010    Savita   Ambedkar     F     C-49, G-Block,     Mumbai     400051   1987-07-11  50000       5
                                              Bandra Kurla,
                                              Bandra East
                                                  Table 5.3: EMPLOYEE table



          190  Touchpad Informatics Practices-XII
   199   200   201   202   203   204   205   206   207   208   209