Page 453 - Computer_Science_F5
P. 453

Computer Science  Access, MySQL, and PostgreSQL.
             (a) Names of tables

                The names of the tables are route, bus_company, and schedule
             (b) Names of columns
                (i)  The table route has the following columns: route_number, route_ name,
          FOR ONLINE READING ONLY
                    origin, destination.
                (ii)  The table bus_company has the following columns: company_ id, route_
                    number, owner_name, post_code.
                (iii) The table schedule has the following columns: schedule_number, route_
                    number, departure_time, arrival_time.
             (c) Data types
                (i)  The data type for route_number, company_id, schedule_number, and
                    post_code will be integer.
                (ii)  The data type for route_name, origin, destination, and owner_name will
                    be characters of varying length (preferably 50 characters).
                (iii) The data type for departure_time and arrival_time will be date time or
                    time (depending on your preference).

             Note: The physical data model and relationships between entities will be covered
                    in more detail in this chapter’s subsequent sections.

                                                     key, candidate key, alternate key, foreign
                Activity 8.2:
                                                     key, selection, and projection.
             Designing a Data Model
                                                     (a) Attribute or field
            Following the real-life example
            provided, design a data model for a      Attributes or fields describe characteristics
            shop encompassing conceptual, logical,   or properties that define all items about
            and physical data models. Focus on       a particular category. An attribute is also
            three key entities.                      a named column in a database. e.g., first
                                                     name, postal code, and date of birth in the
                                                     employees’ database.
           Relational database terminologies
           and their application                     (b) Tuple or record
           As mentioned earlier, the relational  A tuple or record is a data set representing
           database is a type of database that focuses  a single item. It is a collection of related
           on the relationship between stored data  data fields or attributes. It is also known
           elements. The fundamental terminologies   as a row in a database. An example of a
           applied to relational databases include   record is, for instance, when you have
           attribute, tuple, relation, domain, primary   an employee’s database  with attributes
                                                     first_name,  post_code,  and  date_of_

                                                 444
                                                                for Advanced Secondary Schools



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