Page 452 - Computer_Science_F5
P. 452

Example 8.1                            (iii) The entity Schedule may

               Create the three data models from a               have the following attributes:
               real-life scenario.                               schedule number, route
                                                                 number, departure time, and
          FOR ONLINE READING ONLY
               Scenario: A route taken by a particular           arrival time.                     Chapter Eight: Databases and Database Management Systems
               bus company, whose buses travel
               according to a given schedule.            (b) Primary keys
                                                            Under the current scenario, the
               Step 1: Creating a conceptual data           primary keys are route number,
                        model                               company ID, and schedule number
               In this step, you have to identify           for entities Route, Bus Company,
               entities  and their  relationships.          and Schedule, respectively.
               There are three entities,  which are:
               Route, Bus Company, and Schedule.         (c) Foreign keys
               Concerning relationships,  one route
               can have one or many bus companies           According to the relationships
               offering  transportation  services  to       established in Step 1, the route
               passengers. Also, a route can have one       number from the entity Route
               or multiple transportation schedules.        will become a foreign key in the
                                                            remaining entities, which are Bus
                                                            Company and Schedule.  This
                Step 2: Creating a logical data model       implies that there shall be an
               Identification   of   characteristics,       addition of one attribute (route
               primary  keys, and foreign keys are          number) in the Bus Company and
               necessary  for the  establishment  of a      Schedule entities.
               logical data model in addition to the
               names of entities  and relationships
               that were formed between entities in      Step 3: Creating a physical data
               step 1.                                             model
                                                         The creation of the physical data
               (a) Identification of attributes          model  requires  defining  the  names

                   (i)  The entity Route may have        of the tables, names of the columns,
                       the following attributes: route   and column data types in addition to
                       number, route name, origin,       the characteristics,  primary key, and
                                                         foreign keys described in the logical
                       and destination.                  data model in step 2. Since the physical
                   (ii)  The entity Bus Company may      data model is also an implementation
                       have the following attributes:    of the database, its specification may
                       company id, route number,         be dependent on a particular database
                       owner name, and postcode.         management  system such as MS


                                                    443
               Student’s Book  Form Five



     Computer Science Form 5.indd   443                                                     23/07/2024   12:34
   447   448   449   450   451   452   453   454   455   456   457