Page 158 - Informatics_Practices_Fliipbook_Class12
P. 158

E0007    Taran    Adarsh     M     B-76, CST Road,   Mumbai     400098  1965-01-13   70000    5      0
                                           Kalina, Santacruz
                                           East
        E0008    Naval   Dhingra     M     E-14 Vivek Vihar    Delhi    110095  1975-08-04   70000    2      0
        E0009   Naveen    Basra      F     28, Aambagan     Jamshedpur  831001  1980-09-24   60000    4      0
                                           Road, Sakechi
        E0010   Savita   Ambedkar    F     C-49, G-Block,    Mumbai     400051  1987-07-11   50000    5      0
                                           Bandra Kurla,
                                           Bandra East

                                   Table 11.6b: Phone attribute is assigned value 0
        To set the default value of the  Phone  attribute to 9999999999, we will use the following statement

        instead of the above ALTER statements:

        ALTER TABLE EMPLOYEE ADD Phone DECIMAL(10,0) DEFAULT '9999999999';

        On executing the above statement, Phone attribute of the tuples that already exist in the EMPLOYEE table

        will be assigned value 9999999999 (see Table 11.6c).



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

          E0002  Dhiraj     Bora      M     Dispur,       Guwahati  781005  1975-09-30  85000    1    9999999999
                                            Kamrup,
                                            Assam
          E0003  Muskan    Taneja     F     8/33, Geeta     Delhi   110031  1990-01-25  100000   2    9999999999
                                            Colony
          E0004   Hiten    Oberoi     M     15, Dimna    Jamshedpur  831018  1985-06-24  100000  4    9999999999
                                            Road, Mango
          E0005  Anshul    Verma      M     House 10,      Noida    201304  1990-01-01  100000   1    9999999999
                                            Sector 16,
                                            Gautam Budh
                                            Nagar
          E0006   Rajit    Gadh       F     12, Beldih   Jamshedpur  831001  1960-05-07  60000   4    9999999999
                                            Triangle,
                                            Bistupur
          E0007   Taran    Adarsh     M     B-76, CST     Mumbai    400098  1965-01-13  70000    5    9999999999
                                            Road, Kalina,
                                            Santacruz East
          E0008   Naval   Dhingra     M     E-14 Vivek      Delhi   110095  1975-08-04  70000    2    9999999999
                                            Vihar
          E0009  Naveen    Basra      F     28, Aambagan   Jamshedpur  831001  1980-09-24  60000  4   9999999999
                                            Road, Sakechi
          E0010  Savita   Ambedkar    F     C-49, G-Block,   Mumbai  400051  1987-07-11  50000   5    9999999999
                                            Bandra Kurla,
                                            Bandra East
                                   Table 11.6c: Phone attribute is assigned value 9999999999
        To add more than one attribute to a table, we can execute several ALTER TABLE statements. Alternatively, we can
        include several attributes in a single ALTER TABLE  statement using the syntax:


          144  Touchpad Informatics Practices-XII
   153   154   155   156   157   158   159   160   161   162   163