Page 470 - Computer_Science_F5
P. 470

For example: Suppose an agriculture-based company wants to store its employees’
              names and contact details. It creates a table as presented in Table 8.8.

              Table 8.8: An example of a table not conforming to 1NF

               emp_id         emp_name                 emp_address       emp_mobile                Chapter Eight: Databases and Database Management Systems
          FOR ONLINE READING ONLY
               101            Hamis Waya               Iringa            0658000770

               102            Erick Misitu             Mbeya             0713876776;
                                                                          0767000771
               103            Mwantumu Chake           Coastal           0688000775
               104            Namdori Mchicha          Arusha            028675432;
                                                                          0736000671

              As you can see from Table 8.9, employees (Erick and Namdori) have two mobile
              numbers, so the company stored them in the same field as you can see in emp-
              mobile. Therefore, this table is not in 1NF as a rule says, “each attribute of a table
              must have atomic (single) values”; the emp_mobile values for employees Erick and
              Namdori violate this rule. To make the table comply with 1NF, we should have those
              anomalies fixed in the data, as indicated in Table 8.9.

              Table 8.9: An example of a table conforming to the First Norm Form (1NF).

               emp_id          emp_name               emp_address          emp_mobile
               101             Hamis Waya             Iringa               0658000770
               102             Erick Misitu           Mbeya                0713876776
               102             Erick Misitu           Mbeya                0767000771
               103             Mwantumu Chake         Coastal              0688000775
               104             Namdori Mchicha        Arusha               028675432
               104             Namdori Mchicha        Arusha               0736000671

              For example, if we want to put Table 8.9 in the 1N, it will look as in Table 8.10



              Table 8.10: The first normalized  form
               Full name         Address                Movie_industry     Sports
               Ismail Makame     Kijichi                Hollywood          Football
               Ismail Makame     Kijichi                Bollywood          Basketball
               Ismail Makame     Kijichi                Hollywood          Basketball
               Ismail Makame     Kijichi                Bollywood          Football
               Rehema Kiongwe Mnazi Moja                Swahiliwood        Netball


                                                    461
               Student’s Book  Form Five



     Computer Science Form 5.indd   461                                                     23/07/2024   12:34
   465   466   467   468   469   470   471   472   473   474   475