Topic outline

  • General

  • UNIT 1:DATABASE CREATION AND MANIPULATION

    Key Unit Competence:

    To create, manipulate and query an access database

    Introductory activity

    In a certain school the following activities are performed:

    New students get registered after paying 5000Frw as registration fees and are admitted in Ordinary level or in different options depending on their performance in Ordinary level national examination. These students pay school fees on termly basis and the first payment is done upon coming to the school and after being registered

    As they follow their lessons students undergo some evaluations and the results of those evaluations are kept. The marks in different subjects and those in Discipline are based on in promoting students to next levels or making them repeat classes or expelled from school in case of serious discipline issues.

    Students engage in different extra curricula activities like clubs, games, etc.

    The school wants to keep all the above information in a computer based database.

    a) Suggest tables that can be used to keep the above information

    b) What is the benefit of keeping that information in a computer database compared to keeping it on a paper?

    c) Which Office program to use to create that database?

    d) Why is it preferable to use the program given in c) instead of using other programs?

    1.1. Understanding database

    Activity 1.1

    1. Explain the term Database

    2. Give examples of databases you know in the society you live in.

    In our information society, record keeping and data processing using database

    has become an important aspect of every organization such as Hospital, School,

    Universities and Governments. Databases are used all the time, often without

    knowing it. For example, withdrawing money from the Bank’s ATM.

    1.1.1. Database concepts

    A. Definitions:

    • Database

    A database is an organized collection of related data so that its contents can easily be accessed, managed, and updated. It is considered to be organized because the data is stored in categories that are accessible in a logical manner.

    • Data

    Data are unprocessed raw facts that include text, number, images, audio, and video. The data are useless for decision-makers until they have been processed or refined in some manner.

    •  Information

    Information is data that has been processed, refined and then given in the format that is suitable for decision making or other organizational activities.

    For example: Report about student fee paid is useful information for finance section.

    •  Database management

    Database management refers to a set of activities performed on the database. Some of these activities are:

    Insertion of new records in tables are,

    •  Deletion of unnecessary records,
    •  Updating records if the information is changed,
    •  Searching for records according to the given criteria whenever needed.

    Database Management System (DBMS)

    The Database Management System (DBMS) is an application software that enables users to define, create, and maintain the database and which provides controlled access to this database.

    The DBMS receives requests (queries) encoded in SQL and translates those queries into actions on the database.

    A database system comprises of five major components:

    1. Data: The database contains both the operational data and the meta-data (the data about data).

    2. Hardware: this consists of the secondary storage (hard disk) on which the database reside together with the associated devices.

    3. Software: Software refers to the collection of programs used within the database system. It includes the DBMS software the application programs, together with the operating system, including network software if the DBMS is being used over a network.

    The application programs that allow users to store information in an ordered manner for timely and quick retrieval is called Database Management System (DBMS).

    4. Procedures: These are the instructions and rules that govern the design and use of the database. This may include instructions on how to log on the DBMS, make backup copies of the database, and how to handle hardware or software failures.

    5. People (users): This includes the database designers, database administrators (DBAs), application programmers and end users.

    B. Why Study Database

    Databases are useful for example many computing applications deal with large amounts of information; they have become an essential component of everyday life in this modern society. Database systems give a set of tools for storing, searching and managing this information

    Importance of database

    •  A database enables to put data on the disposition of users for consulting or updating
    •  The database should manage the privileges granted to its users.
    •  A database can be local in one machine just used by one user or distributed in many machines accessible by many users through a network (sharing of data).

    The main advantage of using database is its possibility to be used simultaneously by many users as per the image below:

    B

    Figure 1. 1. An interaction between a database server and client computers

    1.1.2. Approaches of Database

    A. Paper based database

    This is a kind of database where information is kept on papers.

    Keeping a database on papers makes its management difficult and the size of papers cumbersome.

    It presents the following disadvantages:

    •  Papers can be lost, damaged over time or due to calamities like fire and flood
    •  If there is change in the stored information the hard copies are hard to update or may even rewriting the information on a new copy having the new update
    •  Compared to information kept in a computer, paper-based databases are difficult to copy and search
    •  Papers need a lot of space to store, can be misplaced hence difficult to find.

    B. Computerized database

    When a database is stored electronically on a computer and can be manipulated using a computer, it is called a computerized database. Computerized databases can be of different types:

    i) Traditional File Processing Systems (TFPS) approach

    This is an approach which was used before the invention of modern Database Management Systems (DBMS) but this approach was difficult to use as it required advanced knowledge and to use it one had to have advanced

    programming knowledge which was not easy for a common user. Users had to write application programs to store data in form of files on the computer permanent storage device (Hard Disk) and each application program written by a user had to define and manage its own data.

    Compared to manual management of information, the Traditional File Processing presents the following advantages:

    •  Simplicity: the design of file processing is more simple than designing a database
    •  Efficiency: file processing cost less and can be more speedy than database
    •  Customization: you can customize file processing more easily and efficiently than database because files are related with the application and it has all the data needed for that application.

    In File-based processing, for each database there is a separate application program as shown by the following figure:

    B

    Traditional File Processing System presents the following disadvantages:

    •  Separation and isolation of data: as data is isolated in many files, it is not easy to have access to data.
    •  Duplication of Data: because of the decentralized management, data may be scattered on different computers and this has as consequences a misuse of storage space as data is repeatedly stored in different locations

    (This is known as Data Redundancy) and a loss of data integrity as data is stored in different locations and the different copies may be slightly different.

    •  Wastage of storage space: Duplication of data leads to wastage of  storage space. If the storage space is wasted it will have a direct impact on cost. The cost will increase.
    • Loss of data integrity: Data integrity means data consistency. Duplication of data can also lead to loss of data integrity; the data are no longer consistent.
    •  Data dependence: in traditional file processing, the structure of data files is embedded in the application programs, so any changes to the structure of a file may require changing all programs that access this file.

    Therefore, data dependence means the application program depends on the data. This means that if some modifications have to be made on data, then the application program has to be rewritten.

    •  Incompatible file formats: the structure of files is embedded in the application programs and therefore structures are dependent on the application programming language.

    The many difficulties attached to using Traditional File Processing Systems prompted researchers to invent another way to use in order to make data management more effective. This came up with another approach which is DATABASE and Database Management System (DBMS)

    ii) Database Management System (DBMS) approach 

    DBMS is a software that provides a set of primitives for defining, accessing, and manipulating data. In DBMS approach, the same data are being shared by different application programs. As a result, data redundancy is minimized. The DBMS approach structure is shown in the following figure.

    B

    • Advantages of DBMS

    There are many advantages of database management system.

    Centralized Data Management: In DBMS all files are integrated into one system thus reducing redundancies and making data management more efficient. One user can know data in another department without moving from one department to another. This is called data integration.

    Data Independence: Data independence means that programs are isolated from changes in the way the data are structured and stored.

    Data consistency: In DBMS, data inconsistency is avoided. Data inconsistency means different copies of the same data will have different values.

    For example: Consider a person working in a branch of an organization. The details of the person will be stored both in the branch office as well as in the main office. If that particular person changes his address, then the “change of address” has to be maintained in the main office as well as the branch office. In case the “change of address” is maintained in the branch office but not in the main office, then the data about that person is inconsistent. DBMS is designed to have data consistency which makes DBMS have the quality of increased data integrity.

    Data sharing: Due to the fact that data is centralized, many different users from different locations can share data.

    Data recovery after a crash: After a break down, DBMS allows to recover data after a crash. The crash may be caused by power failure or hardware failure.

    Concurrent transaction control: A transaction means a collection of operations that perform a single action in a database. Example: Transferring money from one account to another.

    Concurrent transactions mean that many transactions are being done simultaneously or concurrently.

    Concurrent transaction problem occurs when multiple users want to access data in the database at the same time like for example when someone wants to withdraw money from his/her account while at that time there is someone else who is using ATM card to withdraw money from the same account. DBMS ensures that many users are accessing data and these problems are controlled.

    Increased Data security and safety: DBMS allows data to be highly protected against unauthorized access.

    Application activity 1.1

    1. Differentiate paper-based database from a computerized database and give examples

    2. Give some loopholes in Traditional File Processing system which called for another approach to keep and manage data

    3. Give examples of DBMS

    1.2. Key terms used in Database

    By doing a research using books or the internet explain the followings database terms

         i) Entity

        ii) Attributes

       iii) Relational Database

       iv) Cardinality

       v) Table

        vi) Primary Key

        vii) Foreign key constraint

        viii) Alternate Key

    A. Relational Database

    There are different types of database but the most common type is the one that use tables commonly known as Relational Database

    A relational database is the one having one or many Relations which are the mathematical concept representing physically a table

    In this kind if database, the table also known as an Entity may have two or many columns also known as Attributes or Fields and details on items are stored in rows also known as Tuples or records. A certain column has some values that is allowed to accept and those are called Domain

    B

                                 Figure 1. 4. An example of a Relation with rows and columns

    Cardinality refers to the number of rows in a table. In the above table cardinality is 6

    Degree of a relation (table) equals to the number of its attributes (columns/ properties/fields). For example, in the above table, degree is 5.

    Properties of Relations in a relational database

    A table (relation) in a relational database has properties which have to be met:

    • The relation has a name that is distinct from all other relation names in the database
    •  Each cell of the relation contains exactly one atomic (single) value;
    •  Each attribute has a distinct name;
    •  The values of an attribute are all from the same domain. The domain is the type of data acceptable in a column. For example, a Name column should not accept only numbers data
    •  Each tuple is distinct; there are no duplicate tuples;
    •  The order of attributes and tuples has no significance

    B. Primary Key

    In a database table, a primary key is a column or combination of columns that uniquely identifies table records. This column does not accept null values and all its values are unique. The primary key column can be created by the database manager or can be generated by the database according to the defined sequence.

    In Access, when an auto generated primary key is ID which is a sequence of numbers starting from 1.

    A table can have only one primary key, which may consist of single or multiple fields. When multiple fields are combined and used as a primary key, they are called a composite key. If the primary key is already defined, it is not possible to have two records having the same value in that field.

    The figure below shows an Access table in which an IDNumber column plays the role of a primary key. The values in that column are unique, no value is like another and no cell is empty (no null values)

    B

    C. Foreign Key

    A foreign key is a field or collection of fields in one table that refers to the primary key in another table. The table containing the foreign key is called the child table, and the table containing the candidate key is called the referenced table, parent table or master table.

    The image below shows a table with a unique value column whose values are those from the master table, the IDNumber is the primary key of the IDENTIFICATION table while in the MARKS table the IDNumber is the foreign key. All values in the Master table don’t need to be in the child table.

    B

    D. Candidates keys

    All attributes that can uniquely identify an entity are called candidates keys.

    They are never NULL and cannot allow duplication of values. When multiple possible identifiers exist, each of them is a candidate key. For example, in IDENTIFICATION table, IDNumber and PhoneNumber are both candidate keys.

    E. Alternate key

    A relation may have many candidate keys. If only one candidate key is selected as a primary key of that relation, the remaining candidate keys are called alternate keys.

    F. Composite key

    A composite key is a combination of two or more columns which play the role of a primary key and therefore uniquely identify each row in a table. A key composed of more than one column is created when there is no single column alone that can satisfy the conditions of a primary key (with unique values and no null values).

    G. Structured Query Language (SQL)

    SQL is a programming language used for managing data in a relational database

    SQL can be used to create a database and tables inside that database, insert and delete data in tables, query the database and whatever other task to be done on a database.

    SQL statements look like ordinary English though the words may appear straight or are in a shortened form. Below is a statement in Access that displays information from the table IDENTIFICATIONS.

    b

    When the SQL statement above is run, it displays all the records in the table

    IDENTIFICATIONS

    H. Distributed database

    A distributed database is the one that consists of two or more database files located in different sites either on the same network or on entirely different networks. Portions of the database are stored in multiple physical locations and processing is distributed among multiple database nodes.

    The concept of a distributed database is contrary to centralized database which keeps the database data in the same location, on the same computer.

    I. Object oriented database

    This is a kind of database in which, like in Object Oriented Programming, data is represented in the form of objects and classes. Objects are real life entities which model.

    J. NoSQL

    Structured Query Language is used when the database is organized in tabular form. SQL can be used to query a database only when they are in tables and when they are not other means have to be used.

    When the database is not relational, is very large and can store non structured, structured, semi structured and polymorphic data then it is a NoSQL database and therefore requires a non Sql language to query it.

    The concept of NoSQL databases was first thought when giant firms like Facebook and Google faced the problem of dealing with huge volume of data and thus making their relational database very slow to respond. To resolve this problem it came in their minds that they could upgrade the existing hardware and this is very expensive. The last solution is to distribute the database load on multiple host (scaling out) whenever the load increases.

    NoSQL database being non-relational is more suitable to scaling out better than relational database.

    K. Database Management System (DBMS),

    DBMS serves as an interface between the database and end users or application programs to make sure that data is well organized and remains easily accessible.

    DBMS helps provide concurrency, security, data integrity and uniform data

    administration procedures. Advanced query languages such as SQL are used

    along with the DBMS package to interact with a database.

    Some DBMS examples include MySQL, SQL Server, Oracle, dBASE, FoxPro, Access, etc

    L. Constraints of integrity

    These are conditions to be respected by all valid relations to emphasize the data integrity.

    Types of constraints:

    • Primary key constraints: Every table should have a primary key to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce the entity integrity.
    • Unique constraints: The unique constraint enforces the uniqueness of the values in a set of column, so no duplicate values are entered. The unique constraints are used to enforce the entity constraints as the primary key constraints.
    •  Foreign key constraints: The foreign key constraint prevents any actions that would destroy link between tables with the corresponding data values. A foreign key in one table point to a primary key in another table. The foreign key constraints are used to enforce the referential integrity.
    •  Check constraints: These are used to limit the values acceptable in a column. For example, in a column called marks, if the maximum is 100, values should be between 0 and 100. The check constraints are used to enforce the domain constraints.
    •  Not null constraints: a not null constraint enforces that a column will not accept null values.
    •  Default constraints: Default constraints define what to do when a row is inserted with data for the column on which no constraint has been defined.

    For example, a default value can be set to be 0 for a column that contains numerical values.

    Application activity 1.2

    1. What do you understand by the relational Database

    2. List properties of Relations in a relational database

    3. Explain the following terms:

           a) composite key,

          b) candidate key

    4. Discuss what will happen if the primary key must contain 2 separate columns

    5. State the primary key constraint

    6. Using the below Students table

    b

    Find the below:

         a) Degree of the Students table

         b) Cardinality of the Students table

    1.3. Data type

    Activity 1.3

    Karenzi was given a word document containing information. He had to enter into the MS Access but he got many error messages from MS Excel .He found it difficult to proceed with entering data. The image below shows the table and the message he got as he entered data.

    b

        a) What may be the cause of such error messages?

        b) What can he do to avoid those error messages and proceed with entering data?

       c) When Karenzi wrote in The YearOfStudy column the word “Year Two” he got the same error. What can be the cause?

    Data Type defines the type of value that can be stored in a table column.

    Database Management Systems and programming languages have a range of data sets they can accept.

    DBMS tables accept specific values depending on the choice of the database administrator who created the database tables. Other DBMs may have different data types not found in Access.

    For example: Oracle has these data types: Float, Long, Binary_Float, Clob, etc

    The following are the data types to choose from while creating an Access table in Office 2013: Short Text, Long Text, Number, Date/Time, Currency, AutoNumber, Yes/No, OLE Object, Hyperlink, Attachment, Calculated and Lookup Wizard.

    A. Different data types

    The description of each data type is in the table below:

    b

    b

    A. Which data type to use

    The data type to use is dependent on the size to store in the cell and the operations to perform on the stored data.

    For example: numbers can be stored as text, mathematical calculations like addition and multiplication, cannot be performed on such numbers.

    Take into account the size and length of the data to store and also don’t define

    unnecessary big data type. It would be a waste of memory if the database

    administrates defines a column data type as Long Text while every cell in this

    column will store less than 255 characters, here define it as a Short Text.

    When a data type is defined, it takes its space and if one defines a Long Text instead of a Short Text, he/she would be losing 63,744 characters (equivalent to 63999-255). When bigger data types are unnecessarily defined the database becomes big therefore slow to access.

    Application activity 1.3

    In the table below, you are given a column name and an example of data that can be contained in this column. Complete the Data Type column, indicating the appropriate data type to use in each column.

    b

    1.4. Database design steps

    Activity 1.4

    Read the following scenario and give answers to the asked questions At Groupe Scolaire Kinazi, the management of students’ information is not computerized. The Head teacher is looking for a solution so that the

    database of students can be managed digitally and hence speed up the production of school reports and access to information when needed.

    Suppose you are given the task to design that database:

    1. Discuss the different steps you will go through to design a database that will manage student information

    2. Discuss the benefits for the school when teachers start using the new computerized database.

    The most important thing to do to start designing a database is to plan ahead.

    When a case that needs a database creation is presented, before switching ona computer and starting creating the database it is better to think about the type of information to work with and the types of questions that the database should answer, what information needs to be stored and what specifically are the links between them. The next phases are to verify all requirements specifications, to represent the data with diagram, and to plan the database.

    When data is more complex, there are more needs to plan. Even the simplest database should be thought thoroughly on paper before being created using Database Management System such as Microsoft Access, SQL, MySQL, etc.

    A well-designed database performs well and adapts to future needs by giving users access to essential information. Poor planning often results in a database that fails to meet the current needs or the needs that may arise in the future cannot easily be integrated in the existing database

    In planning the database, regardless of its size and complexity the following basic steps are used:

    •  Gathering information (investigation)
    •  Identify the objects (Important Entities and their Attributes).
    •  Model the objects.
    •  Identify the types of information for each object.
    •  Identify the relationships between objects.
    •  Database optimization through normalization.
    •  Data entry and manipulation

    1.4.1. Gathering information

    Before creating a database, there is a need to understand the problem that the database is expected to solve. If the database is to replace the traditional method, file based approach method, then the existing system will give most of the information needed.

    In this step there is a need to work with everyone involved in the existing system which can be a paper based database, an old database or no database at all. Gathering techniques include collecting copies of customer information, management reports, and any other documents that are part of the existing system or interviewing staff who are familiar of the work done in that institution, the staff who are expected to use the new database or who use the old one.

    This step is useful in designing the database and the interfaces.

    The output of this step is information on how the business of an institution is carried out and this can be analyzed to derive the different tables (entities) that will be needed.

    1.4.2. Identifying the important entities and their attributes

    During the process of gathering information, the key objects or entities that will be managed by the database must be identified. The object can be a tangible thing such as a person (for example student, employee, and patient), a product, or it can be a more intangible item, such as a department in an institution, a Combination in a school. Each distinct item in the database should have a corresponding table for which column titles are attributes of the entity

    1.4.3. Identifying the Relationship Between entities

    It is good to relate or associate information about various items in a database.

    Identifying the relationship between entities in the design process requires looking at the entities and determining how they are logically related and adding relational columns (foreign key) that establish a link from one table to another.

    After identifying the relationship between entities an Entity Relationship (E-R)

    Diagram is created using appropriate symbols.

    1.4.4. Modeling the objects

    As the objects in the system and their attributes are identified, they are recorded in a way that represents the system visually. They are recorded using Relational model and Entity Relational model.

    1.4.5. Identifying the types of information for each object

    After identifying the primary objects/entities in the database as candidates for tables, the next step is to identify the types of information that must be store for each object.

    These are the columns in the table of the object. Fields/columns should be kept simple, the more atomic are the fields the more flexible will be the database.

    For example, in a database of names and addresses, it is better to keep each part of the person’s name as a separate field.

    1.4.6. Database optimization through normalization

    One of the most important step to consider when designing a database is database definition. If tables are not set up properly, it can cause a lot of headaches at the time of extracting/retrieving required data.

    Normalizing a database eliminates redundancy, and other anomalies that may arise as the database is being used. Redundancy means that the same data is saved more than once in a database.

    Those anomalies are: insertion anomalies, deletion anomalies and updation anomalies. Normalization will be developed in details in the subsequent sections.

    • Update anomalies: If data items are scattered and are not linked to each other properly, then it could lead to strange situations where one row is updated but others are left with old values leading to inconsistency in database.
    •  Deletion anomalies: As data may be scattered somewhere else, in a database that is not normalized when one record is deleted, other related records may remain in the database.
    • Insert anomalies: In a very long table which is not normalized, one may need to insert some values but may not have values to insert for some columns which may lead to tables in which some cells are filled while others are empty.

    Normalization is a method to remove all these anomalies and bring the database to a consistent state.

    A Properly normalized design allows to use storage space efficiently, eliminate

    redundant data, reduce or eliminate inconsistent data and ease the database maintenance

    1.4.7. Data entry and manipulation

    When the database is completely designed the last step is using it by putting in it the data. Data can be manually entered from hard copy forms or it can be imported from other files like excel or other files supported by the current one.

    While entering data or importing it from other files make sure the data is valid because if the database has strong validation rules, which is an ideal, it will not accept those data.

    Application activity 1.4

    1. Discuss the activities carried out during the data gathering phase in the design of the database

    2. What is the difference between insertion anomalies and update anomalies?

    1.5. Creating, Saving, Closing and Opening a database

    Activity 1.5

    Using Ms Access, you are tasked to create a database of a mini supermarket:

    1. Name and create three table (Customer, Employee and Product)

    2. Identify for each table the name of the column that will have unique values (values that don’t resemble and no duplicate values in the whole column and that cannot contain null values)

    3. Discuss the importance of such a column (given in 2) in a table

    A. Creating and saving a database

    A database is a collection of information. In Access, every database is stored in a single file and has to have a name and different objects.

    Different objects in an Access database are tables, queries, forms, reports, macros, and modules.

    Tables: They store information. A database can have as many tables as are needed.

    •  Queries: They let database users perform actions on tables which can be data definition queries or data manipulation queries.
    •  Forms: Those are attractive windows created by the database user and provide a way to view or change information in a table
    •  Reports: They are summary of the information contained in different tables which have a common characteristic.
    •  Macros: They are mini-programs that automate custom tasks.
    • Modules: they are files that contain Visual Basic code that can be used to perform different tasks like updating 10,000 records or firing off an email.

    To create an Access database first start Microsoft Office Access by clicking on the start button then on Access 2013, in the window that will appear write the database name and click on Create

    b

    The new database is now created but has no table. Tables can be created usingone of the available options: Datasheet view, Design View

    i) Creating a table in Datasheet view

    When the database is created, the default option to create tables is using the Datasheet view. The Datasheet view is the option which allows to view many rows in a table at the same time. This option also allows to filter and sort data using the built in sorting and filtering options. This view is also useful for quickly viewing the details of many records, adding new records and deleting records from a table.

    To create a table in Datasheet view, do the following:

    •  Click on Create menu then on the table icon. New table with two columns and one row appears

    n

    To add new columns to the existing table in the image above click on the drop down arrow next to Click to Add. In the list of data types that will appear choose one suitable to the information to be kept in the column

    B

    Figure 1. 9. Window to choose data type (Left), to set the column name (Right) and name the table (Bottom Right)

    • Write the name of the new column. Repeat the same steps of choosing the data type and renaming the column up to when you have all the needed columns.
    •  Save the table by clicking on the save icon , write the table name and click on OK

    ii) Creating a table in Design view

    A table can also be created in Design view and this provides additional options compared to the Datasheet view like adding/changing the primary key and changing the column data type. In Design view, the table structure is created but entering data requires using the Datasheet view

    To create a table in Design view go through these steps:

    • On the Create tab, in the Tables group, click Table Design or in the Views group click on the View tab then choose Design View

    B

    • In the new window that will appear, specify the field names, Data types and the descriptions of the fields (optional) and set the primary key by selecting the field name then clicking on the Key icon . The primary key column will then have a key icon on in front of it
    •  Save the new table by clicking on the save icon and specifying the name

    B

    B. Opening and closing a database

    A database created can be closed by clicking on the close icon of the Access window in which it is opened. This same database can also be opened by first opening Microsoft Office Access then going to the File tab then choosing the Open option and browsing the database to open.

    Once the database is opened, it will show its different objects (Tables, Queries, Forms, Report), choose the one you want to have access to.

    Application activity 1.5

    Create a database in Ms Access and name it “Marks“ and save it on the desktop

    2. Create two tables in which we are going to keep marks for SET for Primary 2 and Primary 3 , name it respectively “SET marks for P 2” and “SET marks for P 3”and specify the primary key for each table

    Table “SET marks for P2”

    B

    Table “SET marks for P3”

    B

    3. Discuss the role played by the primary key in the relational database

    1.6. Creation of table relationship

    Activity 1.6

    What do you understand by relationship in relational database?

    2. What is the Entity Relationship Diagram?

    Table relationship is the backbone of database management as it helps in making the many tables seem one. Without this option it would not be possible to retrieve data from different tables at the same time but every table would be taken as a separate entity. For tables to be logically related they have to have a common column which binds them; this is the foreign key.

    A relationship is established between two tables when one table uses a foreign key that references the primary key of another table. This is the basic concept behind the term relational database.

    Here is in brief why table relationships are needed:

    • As most of the time a database has more than one table to work while running queries it is necessary that tables be related as the query works by matching the values in the primary key field of the first table with a foreign key field in the second table.
    • While designing a form or a report, MS Access uses the information it gathers from the table relationships you have already defined to present you with informed choices and to prepopulate property settings with appropriate default values.These foreign key-primary key pairings form the basis for table relationships and multi-table queries.

    A. Different relationships

    There are three main relationships in database tables namely one to one, one to many (or many to one) and many to many.

    i) One to one (1:1)

    In a one to one relationship one record in one table can be related to only one other record in the other table. This kind of relationship can be implemented in a single table and therefore does not use a foreign key which is needed only when

    two tables are to be related.

    This kind of relationship is not so common as the data stored in table B could just have easily been stored in table A. However, there are some valid reasons for using this relationship type like security purposes, the need to diminish the number of columns in a table and slash it into smaller tables, and various other specific reasons.

    These are examples of One to One relationships in real life:

    •  In a marriage, each spouse has only one other spouse.
    •  A son has only one mother
    •  A car can be driven by one driver at a time
    •   A President and a country

    ii) One to many /many to one (1:M / M:1)

    A one-to-many relationship allows a single record in table A to be related to multiple records in table B but a record in table B can have only one matching record in table A. This is the most common type of relationship and it is used to relate one record from the ‘primary’ table with many records in the ‘related’ table.

    Examples:

    • Consider a business with a database that has Customers and Orders tables. A single customer can purchase multiple orders, but a single order could not be linked to multiple customers.
    •  A mother can have many children
    •  A businessman can have many cars
    •  One federate country can have more than one state

    iii) Many to many (M:M)

    Two tables have a many-to-many relationship when a single record in the first table can be related to one or more records in the second table and a single record in the second table can be related to one or more records in the first table.

    Briefly two tables A and B are said to have a many-to-many relationship when A record in Table A can have many matching records in Table B, and a record in Table B can have many matching records in Table A.

    Examples:

    •  The relationship between TEACHER entity and STUDENT entity is an example of many-to-many relationship. One teacher teaches many students and one student is taught by many teachers.
    •  Many students are taught by many teachers
    •  Many customers may buy many products

    B. Entity relationship diagram for different relationships using Peter Chen notation

    An entity relationship diagram (ERD) shows the relationships of entity sets stored in a database. These entities can have attributes that define their properties. By defining the entities, their attributes, and showing the relationships between

    them, an ER diagram illustrates the logical structure of a database. ER diagrams are used to show the design of a database.

    There are different reasons to create a database diagram but the min one  is to document it so as to facilitate the task for anyone who wants to know the organization of the tables and be able to administer that database. Once the database is documented in this way, it is easy to manage it by learning any queries. It is also easy to know which other tables can be created as the business changes and how they will be related to the existing tables.

    a) Different diagrams used

    For drawing an entity relationship diagram of a database the following symbols summarized in the table below are used:

    X

    B

    D

    B

    B

    The type of relationship between entities is on the connecting lines by M to symbolize many and 1 to symbolize one.

    b) Linking different shapes to construct an Entity Relationship Diagram

    The relationship is shown by a table diagram on one side and another table diagram on the other side which are separated by a diamond in which is the relationship name. Between the rectangles and the diamond are lines on which is the cardinality of the relationship. The tables below summarizes how these are linked:

    B

    c) An example of an Entity Relationship Diagram for a Library database

    The database below is of a school library which lends Books to students upon their request. Those students study in different Combinations and order books that they will return after reading them within 15 days. The Entity Relationship

    Diagram below shows the relationship between the tables (STUDENTS,ORDERS, BOOKS, COMBINATIONS) of this database

    N

    Application activity 1.6

    You are required to create a conceptual data model of the data requirementsfor a company that specializes in IT training. The Company has 30 instructors  and can handle up to 100 trainees per training session. The Company offers five advanced technology courses, each of which is taught by a teaching team of two or more instructors. Each instructor is assigned to a maximum of two teaching teams or may be assigned to do research. Each trainee undertakes one advanced technology course per training session.

    a) Identify the main entity types for the company.

    b) Identify the main relationship types and specify the multiplicity for each relationship. State any assumptions you make about the data

    c) Using your answers for (a) and (b), draw a single ER diagram to represent the data requirements for the company.

    1.7. Establishing table relationships in Access

    Activity 1.7

    1. Find attributes for STUDENTS, BOOKS, COMBINATIONS, ORDERS

    2. Draw the ERD for STUDENTS, BOOKS, COMBINATIONS, ORDERS

    3. Open Microsoft Access 2013 and create a tables STUDENTS, BOOKS, COMBINATIONS, ORDERS.

    4. Create relationships among these tables.

    A. Quick creation of the tables

    •  STUDENTS table

    The student table will have 4 columns namely StdID, First Name, Last Name and Sex. The data types for all the columns is Short Text. The Sex column will allow only two values: male and female.

    b

    The StdID field does not need to be too long, that is why we specify its length as 15. The length of the a field is specified in the Field Properties shown in the image below which is the part of the window for fields definition.

    V

                 Figure 1. 14. Field Properties where to define different fields specifications

    Using this same Field Properties window, one can specify different properties of the table fields like a customized error message when wrong data type is entered in a table and validation rules.

    •  The ORDERS table

    This table will contain information about students who bollow books in the library, the bollowed books and the details on borrow and return dates. For this table to store information on students and on books it is not necessary to have all the columns for these entities as just one field referencing those table is enough. That field plays the role of the foreign key.

    The values of StdID column will be those that exist in the Student table StdID column while those in the BkNumber column are those that exist in the Books table BkNumber column

    B

                                Figure 1. 15. Structure of the ORDERS table

    •  The BOOKS table

    The BOOKS table has seven rows namely BookNumber which uniquely identify every book (primary key), the BkCategory, BkTitle, Author, PublicationDate, ValueRWF and Status. This table does not have a foreign key meaning that it does not have a field which refer to fields in other tables but has the BkNumber column which is referred to in the ORDERS table

    B

    • COMBINATIONS table

    This table keeps information on students with their combinations. The fields are Combination which keeps the name of the combination in which the student studies, the StdID column which contain the unique identification number for the student who studies in that combination, the SchoolYear and the YearOfStudy.

    The StdID column in this table serves as a foreign key referencing the student table.

    V

                   Figure 1. 17. The structure of the COMBINATIONS table

    B. Creating relationships

    As it has been seen tables which are not normalized present many anomalies which make such a database very bad. When database is normalized, its tables are broken down into smaller tables which help eliminate redundancy but there must be a mechanism to link those tables so that they can be queried as one.

    The mechanism used is to relate different tables by using foreign.

    Referring to the ERD of the Library database the following relationship is built:

    • Relationship between Students and Combinations tables

    This relationship links the two tables Students and Combinations by using the StdtID column which is the primary key in the Students table and is a foreign key in the Combinations table. This means student identification numbers in the Combinations table must first appear in the Students table. Any attempt to enter in the StdID column of the Combination table data that is not in the Student table will result in an error.

    A relationship between tables is built like this:

    • Under the Database Tools tab click on Relationships
    •  Drag and drop the tables between which to create a relationship from the left pane to the
    •  relationships area. Tables are dragged
    • Arrange the tables properly so as to make an easy to ready diagram once the relationship is created
    • Click and hold down the column name from which the relationship is to be established and move the cursor (from left to right) to the other related column in the other table. The window below that will appear will help in editing the relationship

    B

                  Figure 1. 18. Different options for establishing table relationship

    • Continue the process in the above bullets until all the tables to be linked are linked.

    Note that the columns to link have to be of the same data type and of the same length if not so the attempt to create a relationship will result in an error.

    After linking all the tables, the relationships between the library database tables will look like in the image below:

    B

                                   Figure 1. 19. The library database tables with their relations

    C. Calculated fields

    There are fields in this database that have rules they have to follow in terms of format, length. They must also to be unique and not allow null values for all these rules to be easily respected, it is better to let access determine their content.

    Those columns are the StdID column in the Students table, the OrderID column in the Orders table and the BkNumber column in the Books table.

    To set a calculated field in Access do the following:

    • While defining the table structure and choosing the data type select Calculated
    • In the new window write the expression builder that will generate data you want

    Note that to build an expression you have the inbuilt functions, table columns, constants and operators

    B

                   Figure 1. 20. Window used to set an expression builder for some fields

    Application activity 1.7

    Discuss the benefits of having a calculated expression in an Access table

    2. By doing a research explain the use of different expression builder elements and use them in defining calculated expressions.

    3. Using Entity in the below table , Create tables using these entities in Ms Access and create relationships among these tables

    B

    1.8. Adding Data to a database (Data Entry)

    Activity 1.8

    Using your own terms, explain what is data entry in database

    2. What are the 3 difficulties you may encounter when entering data into Ms Access database?

    3. Discuss ways you can use to add data to an Ms Access database

    Data entry is a direct input of data in the appropriate data fields of a database, through the use of a human data-input device such as a keyboard, mouse, or touch screen, or through speech recognition software.

    Before doing a data entry make sure you know which fields to enter and the validation rules associated with those fields. This will help in avoiding to enter a wrong data type in a field and knowing that the database will not accept that data type, it will take time to figure out the right data to enter. Know which fields get data from other fields (lookup), fields that have specific values (like yes/no). In short, study your table/form before entering data.

    Adding data to an Access database can be done in 3 main ways:

    •  Data entry through a front end interface
    •  Entering data in a Datasheet view table
    •  Entering data using an Access form

    A. Data entry through a front end interface

    In programming and development, a front-end is a term that describes a user interface that is used to interact with the database instead of working directly with the database. For example, a website front-end developer handles the visual aspects of how the web page looks and responds to the visitor. The front end interacts with the back end (database) which may be on the local computer or remotely placed on a server.

    The front end provides forms which are developed using different languages like HTML (HyperText Markup Language), HTML5 and programming languages to link the webpages to the database like PHP.

    The forms provided by the front end has different fields which correspond to the fields in the database and alert the data entry clerk whenever form validation rules are not followed. They also provide a “submit” button on which to click for sending data in the database

    B

    Figure 1. 21. An example of a form that can be used to enter data to the database

    B. Entering data in a Datasheet view table

    Datasheet view is one of the table viewing in Access which allows a user to enter directly data in a table. FILL THIS PARAGRAPH

    B

    To add records to a table in datasheet view in Access, click into this row and enter the new record. The asterisk will then change to a picture of a “pencil” as data is being entered. The pencil will let you know which record that is being edited. Another new “New Record” row also appears when you are done with the current row.

    While entering data in an Access table make sure you follow the validation rules of the table because of they are not respected, the data will not be accepted.

    To add records to a table in datasheet view, open the desired table in datasheet view and follow these steps:

    •  In the Home tab click the “New Record” button located in the Records group to make the cursor go in the first cell of the new record or just click in the first cell of the last empty row.
    • Enter the information into the fields in the new row by making sure validation rules are respected
    • Move to the next field by clicking in it or by using the keyboard backspace.

    Using the backspace key while the last cell is reached will move the cursor to the new record

    •  Close the table when you are finished adding records.

    C. Entering data using an Access form

    Microsoft Access 2013 provides different objects the common ones being tables, queries, forms and reports.

    Access forms are accessed by clicking on the Create tab then select one of the form options provided in the Forms group

    B

    The Form tool is used to view table data in a form format and is accessed just by opening the table and clicking on 

    the Form tool N

    To navigate in the form’s data or to enter new data use the tools available on Record tools group. By using the tools in this group one will be able to move to the next row, move to the last row, empty the form so as to enter new data and searching for a row containing specific text

    B

    N

    C.1. Designing a form from scratch

    A form can also be designed from scratch and not created from an existing table. The created form will then create a table to which it will be linked.

    To create a form from scratch go through these steps:

    •  Under the Create tab click on the Form Design tool
    •  In the form area drag and drop the form design tool to use but before this name your form by using the Title tool found in the header/footer group. If needed also set the form’s logo.

    B

    From left to right the different tools to choose from are: Select tool, Text Box, Label, Button, Tab Control, Hyperlink, Web Browse Control, Navigation Control, Option Group, Insert Page Break, Combo Box, Chart, Line, Toggle Button, List Box, rectangle, Check Box, Unbound Object Frame, Attachment, Option Button, Subform/Subreport, Bound Object Frame and Image.

    C.2. School library form

    Here is a form created from scratch which accepts data and submits it to the database table. It has been created by taking the different tools available for building a form. The different tools dragged from the Form Layout tool are: Logo, Title, Text Boxes, Option Group and Button

    H

    The above Form viewed in the Form view looks like this:

    N

    Application activity 1.8

    Create the below form that can be used to enter student registration information in the database.

    N

    a) Add your school logo.

    b) Make sure the table/form is validated to accept only valid data.

    1.9. Querying a Database in design view

    Activity 1.9

    a) Create and name the table” Own Books” which has columns as below:

    N

    b) Display Book title, Author, Publication Date, and Value for the books in the category of science.

    c) Display books which have value above 40,000

    A query is a request for data results, and for action on data. You can use a query to answer a simple question, to perform calculations, to combine data from different tables, or even to add, change, or delete table data.

    A query is a request to the database tables for data results or for action on data. This query can help answer a question, combine data from multiple tables, perform calculations, change or delete table data.

    In Access, querying a database can be done in two ways: by writing a query in a language that is understandable to the database that is known as SQL query or by designing or by using the Design View approach. This section is going to talk about querying an Access database in Design view.

    The benefits of using queries are so multiple:

    •  As the table increases in size and may have thousands of records, it is so difficult to spot one record by scrolling through the database. The query approach solves this problem by spotting the needed records and performing needed actions on them
    •  A query can help in applying a filter on table’s data and get only what is needed
    •  When one same action is to be performed on many records, it would be a loss of time to repeat every action on every record. Doing it automatically in a query quickens the process

    There are mainly two types of queries in Access:

    •  Select queries which are used to display data from tables or to perform calculations
    •  Action queries which are used to add, change or delete data

    The tables that are going throughout this sections are here below with at least their four columns:

    B

    A. Select queries

    A select query is the one which displays records from one or more tables of a database The SQL SELECT statement returns a result set of records from one or more tables. A SELECT statement retrieves zero or more rows from one or more database tables or database views basing on the selection criteria if there is one

    •  A select query on one table

    To design a select query, do the following:

    •  Under the Create tab click on Query Design
    •  In the “Show Table” window that will appear choose the table on which the query is to be run and click on Add. In this case the table BOOKS was chosen

    A. Select queries

    A select query is the one which displays records from one or more tables of a database The SQL SELECT statement returns a result set of records from one or more tables. A SELECT statement retrieves zero or more rows from one or more database tables or database views basing on the selection criteria if there is one

    A select query on one table

    To design a select query, do the following:

    •  Under the Create tab click on Query Design
    •  In the “Show Table” window that will appear choose the table on which the query is to be run and click on Add. In this case the table BOOKS was chosen

    N

    •  After selecting the table click on Close to close the window
    •  In the table, select the columns to appear in the result. In this case only these columns were selected: BkNumber, BkCategory, BkTitle, and Author.

    B

            Figure 1. 31. Options to select columns to appear in results of a query

    •  If there is a criterion for selection specify it and if there is not one leave the criteria field empty. In this case only books in the science category are going to be displayed
    •  Click on Run to get the results of the query

    N

    •  Select query on multiple tables

    In a normalized database it is possible to link more than two table in order to get a more revealing display (report). For example, in the table that have been used one may need to know the names of students who borrowed science books and their combinations.

    To answer such a question requires to combine columns from three tables and thanks to the foreign keys in the tables this combination is possible. The tables to combine are: STUDENTS, BOOKS and COMBINATIONS.

    To make such a query do the following:

    •  Under the Create tab click on Query Design
    •  Chose the table that are to be used in the new query. Here select all the tables (STUDENTS, BOOKS, ORDERS and COMBINATIONS)
    •  Select the columns that will appear in the results. Those columns are: First Name, Last Name, Combination and BkCategory
    •  Set the selection criteria which is Science

    N

    • Run the query by clicking on the Run tab which is found under the Query Tools

    B

    Note that this kind of query that combines many tables is possible only if tables

    are related by the use of foreign key.

    •  Wild card characters in query criteria

    Wildcard characters are special characters that can stand for unknown characters in a text value and are handy for locating multiple items with similar, but not identical data. Wildcards can also help with getting data based on a pattern match.

    These characters can be used where specific characters are not known like for example one wants to search for names which start with Mu. Such names can be Muhire, Mugabo, Mutuyimana, etc

    b

    Example of a query with a wild card character:

    The query that was created to display students who borrowed Science books can be modified in the criteria field by writing in it the criteria: Like “Sci*”. If there is no BkCategory field which start with Sci other than Science this query will return the same results as the previous one.

    Application activity 1.9

    Using the four tables (STUDENTS, BOOKS, ORDERS, and COMBINATIONS) used through this section create queries in Design View

    that do the following:

              a) Students whose sex is Male

              b) Students whose name start with letter “U”

              c) Books which are in the Mathematics category

              d) Students who study in MPC option in 2010

    1.10. Database normalization

    Activity 1.10

    Create a database “Nziza Supply Ltd” and the table “ORDERS” identified by the columns: CustomerName, Address, TelephoneNumber, CreditLimit, ItemOrdered, Quantity and Price.

    This can easily be implemented in a table as follow:

    n

    However, a customer may order several items and each customer in the database may order a different number of items. This situation makes it difficult to implement the data in a relational database, since we do not know how many order entries to allow

                      1. How many order entries our database design would allow every customer?

                      2. Which problem that a database having such tables present?

    The main objective while designing a database is to create an accurate representation of the data, relationships between the data, and constraints on the data designed to solve existing problems in an enterprise.

    Normalization is a database design technique, which begins by examining the relationships between attributes and use a series of tests (described as normal forms) to help identify the optimal grouping for these attributes to ultimately identify a set of suitable relations that supports the data requirements of the enterprise.

    The goal is to generate a set of relation schemas that allows us to store information without unnecessary redundancy, yet also allows to retrieve information easily.

    The approach is to design schemas that are in an appropriate normal form.

    Normalization is a series of steps designed to remove repeating groups and unwanted functional dependencies. It is also used to avoid insertion, deletion and updating anomalies. Therefore, it used to improve on existing table designs.

    1.10.1. Normal Forms

    The normal forms are a linear progression of rules that are applied to database. With each higher normal form achieving a better, more efficient design.

    Normalization theory defines six normal forms (NF) but the most used are three.

    Each normal form involves a set of dependency properties that a schema must satisfy and each normal form gives guarantees about the presence and/or absence of update anomalies. To correct update anomalies in a database, you must convert tables to various types of normal forms.

    The most common normal forms are First Normal Form (1NF), Second Normal Form (2NF), Third Normal Form (3NF) and Fourth Normal Form (4NF).

    B. First Normal Form

    A relation (table) that contains a repeating group (multiple entries for a single record) is called unnormalised relation. Removing repeating groups is the starting point in the process to create tables that are as free of problems as possible.

    The conversion to first normal form (lNF) requires splitting the data into two groups. Tables without repeating group are said to be in the First Normal Form (1NF).

    First Normal Form (1NF) says that all column values must be atomic.1NF dictates that for every row by column position in a given table, there exists only one value, not an array or list of values. If lists of values are stored in a single column, there is no simple way to manipulate those values. Retrieval of data becomes much more difficult.

    A relation is in first normal form if and only if the domain of each attribute contains only atomic (indivisible) values, and the value of each attribute contains only a single value from that domain

    Example 1:

    A database has been designed to store information about property owners and rental in a table called Client Rental

    n

    b

    As it is obvious in the table above there are cells which contain information in merged cells, all cells are not of equal size (they are atomic cells)

    For a relation to be in First Normal Form, all cells have to be non-atomic cells.

    The above table can be converted into a 1NF table by unmerging the cells and rewriting the information in the new cells

    b

                        Table 1. 3. ClientRental table after being converted to the 1NF

    C. Second Normal Form (2NF)

    Before a table be in the Second Normal Form, it has to be in the First Normal Form. A relation is in 2NF if it is in 1NF and every non key attribute is fully functionally dependent on the primary key. Functional dependency means that wherever appears the same value in one column also must appear the same values in another column.

    In the table below, wherever the RegistrationNumber 0001 appears the column Names has as value UWIMANA Claudine in the same way wherever there is 0003 as RegistrationNumber, there is RWIGAMBA Eric in the Names column.

    This link between one column and another is called functional dependency and can be even in more than two columns.

    b

    In the ClientRental table above, though it is in the 1NF it has got a remarkable issue: the primary key column (ClientNo) does not contain unique values. It contains also a lot of repeated information which consumes a lot of memory

    space if the table has many records and if there are many tables in the database having the same anomalies.

    To convert the above table in the 2NF identify the functional dependency and put together in one table the columns that are functionally related.

    b

    After identifying the functional dependencies, it is clear that the whole table has two sets of functional dependencies which can help generate two tables. Those tables can be Client (ClientNo, CName) and PropertyOwner (propertyNo, pAddress, rent, ownerNo, oName). When these two tables are created, two columns rentStart and rentFinish are alone. We create its table and because the content in those two columns is understandable only when there are the ClientNo and propertyNo those columns are added to that table and may serve as a concatenated primary key.

    n

    Figure 1. 35. Resulting tables after putting the database in 2NF

    Note: the columns ClientNo and propertyNo serve as the concatenated primary key for the Rental table

    However, a close analysis of the ProperyOwner table reveals that there is functional dependency between the columns ownerNo and oName. That functional dependency can be removed by splitting the tables into two. We call the two resulting tables owner and the propertyOwner. To keep a link between these new tables the propertyOwner table will have the ownerNo column as a foreign key.

    b

    D. Third Normal Form (3NF)

    Relation in 2NF have less redundancy than those in 1NF. However these relations may still have update anomalies. This update anomaly is caused by a transitive dependency and must be removed for the database to be in Third

    Normal Form.

    To be in third normal form, the relation must be in second normal form, all transitive dependencies must be removed and there is no non primary key attribute which is transitively dependent on the primary key. The transitively dependent attribute is removed from the relation by placing that attribute in a new relation.

    In the tables shown above there is no transitive dependency therefore the database is already in the 3NF

    Application activity 1.10

          1. Explain why it is necessary to have a normalized database

          2. Convert the table below to the 3NF

    x

    1.11. Database project

    A company that rent cars to tourists manages its information manually by using papers and pens. It wants to have a computerized Access system that will help them efficiently manage its information.

               1. By doing a research explain the steps to go through in order to have this database built

               2. By going through those steps build that database

    Activity 1.11

    Database project is aimed at providing content, that, when properly mastered will enable the reader to create an effective Access database that can solve a real life problem. Examples of databases are: school database, library database, Home expenses database, Gate management database, fixed asset management database and many others.

    The development of any database system goes through a number of steps that will have to be gone through even in the project in this book because when those steps are not followed, the solution (new database system) does not accurately solve the original problem which was in place before thinking about the database system.

    The steps in developing this project are those used in developing a database system and those are:

    •  Investigation
    •  Analysis
    •  Logical design
    •  Implementation
    •  Data entry

    Project I. Investigation

    Task one: Go to an institution for which an Access database is needed like a secondary school and investigate to come up with information that can be based on in thinking of the tables of the future database

    A. Information/Requirements gathering

    The first step in the process aimed at coming up with a new database is requirements Gathering. During this step, the database designers have to interview the customers (database users) to understand the proposed system, obtain and document the data and functional requirements. The result of this step is a document including the detail requirements provided by the users.

    As a person, consultant given the task to build a new database system or entrusted to improve the one already in place, you have the task to thoroughly understand the business process of the institution for which you want to have a system built.

    Be aware of the existing ICT materials and how they are used to manage the current database whether it be a paper based database, or a computerized database that needs improvement. Know also the institution’s documents and their use to get clues of the whole institution’s business

    •  Existing database system description

    Collect all the information in the institution so as to come up with the service offered in that institution and how the different employees who are the prospective users of the new system interact.

    In that institution there may be receptionists, cashiers, accountants, trainers, professionals, supervisors. Know the role of every one and the flow of service from one to another.

    Example: If the database to be built is for a secondary school, at the end of this stage you are going to know that there are administrative staff and teaching staff. The administrative staff group is composed of: Headmaster, Accountant, Secretary, Director of Studies, Discipline Master, Matron, Patron and Teachers. There are also other staff like cooks, gate keeper, cleaners, etc.

    Know the organization structure of this institution (school) in order to know the chain of command which must also be modelled in the database as if the database is to be accessed through an interface supervisors will view more options than subordinates.

    •  Available ICT materials

    Gathering this information will make you aware of the readiness of the investigated institution. If the institution has no single computer, it will not be able to use the database you want to create for them and that can prove a waste of money.

    Check the specifications of the computer and make sure the Access version you want to use will be accepted by that computer and that staff have the basic required knowledge.

    •  Difficulties with the existing system

    If the institution has no database system and manages information in a traditional way by using papers, show the difficulties raised by that way of managing information and therefore the reason why they need to have a computerized database.

    If there is already a database which can be Microsoft Word and Excel files, show why there is an need to shift form that way of managing information to the new Access database.

    The difficulties faced by the existing system are the ones based on in determining whether the solution to replace or improve the current system is valid. Show the proposed solution and its advantages so as to finally weigh the advantages against the cost.

    •  Establish the Data Flow Diagram for the institution

    By the use of specific symbols a dataflow diagram is created to represents how information about different operations in an institution circulates.

    Symbols used to build that data flow diagram are to show the origin and destination of information, data flow, treatment flow and data deposit or storage.

    These symbols are used:

    b

    n

    Example of an institution Data Flow Diagram:

    The DFD below is for a car admission in a garage where the client comes at the reception with the car, requests for information, have the car sent to the mechanics by the receptionist for checkup, the mechanics give feedback to the receptionist to inform the car owner and the car is sent to the workshop for repair.

    b

    Project II. Analysis

    Task 2: Analyze the information gathered in “Project One -Task One” and deduce tables and the relationship among them. The result to this is tables in an Entity Relationship Diagram with table columns but without data types

    The aim of analysis is to obtain a detailed description of the data that will meet the requirements of the future system users so that both high and low level properties of data and their use are dealt with. These include properties such as the possible range of values that can be permitted for attributes such as, in the School Database example; for instance, the Student course code, course title and credit points.

    By the end of data analysis a Conceptual Data Model is produced

    The conceptual data model provides a shared, formal representation of what is being communicated between clients and developers during database development it is focused on the data in a database, irrespective of the eventual use of that data in user processes or implementation of the data in specific computer environments. Therefore, a conceptual data model is concerned with the meaning and structure of data, but not with the details affecting how they are implemented.

    The conceptual data model then is a formal representation of what data a database should contain and the constraints the data must satisfy. This should be expressed in terms that are independent of how the model may be implemented.

    Project III. Logical design

    Task 3: Improve the ERD model by showing the data types used, the primary and the foreign keys.

    Database design starts with a conceptual data model and produces a specification of a logical schema; this will determine the specific type of database system (network, relational, object-oriented) that is required. The relational representation is still independent of any specific DBMS, it is another conceptual data model.

    We can use a relational representation of the conceptual data model as input to the logical design process. The output of this stage is a detailed relational specification, the logical schema, of all the tables and constraints needed to satisfy the description of the data in the conceptual data model. It is during this design activity that choices are made as to which tables are most appropriate for representing the data in a database. These choices must take into account various design criteria including, for example, flexibility for change, control of duplication and how best to represent the constraints. It is the tables defined by the logical schema that determine what data are stored and how they may be manipulated in the database.

    Logical data models add further information to the conceptual model elements. It defines the structure of the data elements and set the relationships between them.

    Project IV. Implementation

    Task 4: Referring to the logical model of your database construct it using Microsoft Office Access 

    Implementation involves the construction of a database according to the specification of a logical schema. This will include the specification of an appropriate storage schema, security enforcement, external schema, and so on.

    In our case the database will be built using Microsoft Access 2013 and forms are needed in order to have an interface through which to interact with the database.

    The tables that will be created will have columns shown in the logical model and the same goes for the primary keys and foreign keys.

    Project V. data entry

    Task 5: Now that the database has already been built enter in the data that the institution had on papers, word or excel files so as to make it usable.

    Data can be entered from the hard copies but it can be imported from Word or Excel applications. To import data from other applications to Access follow these steps:

    •  On the External Data tab click on one of the type of applications (Excel, Access, Txt File, XML file) from which to import data. Here we choose Excel
    •  In the new window that will appear browse the file to import and choose one of the three options and click OK

    b

                                   Figure 1. 38. Window to browse for files to import in Access

    In the new window specify that the first row contains column headings if it meets the criteria of a valid Access table heading and click Finish or Next for additional options.

    Note that if the option to make the first row be the Access table heading, Access will create default headings in the form of ID, Field1, Field2, Field3, etc

    b

                                              Figure 1. 39. Window to specify heading

    In the window that will appear specify some information on the columns to import like Field names which can be changed or kept as it is, specify if the column is to be indexed or not, specify the data type or specify which columns not to import

    n

          Figure 1. 40. Access window to specify field names, data types and columns to import

    In the next window follow the prompts and specify the primary key and the table name once it is in Access.

    Application activity 1.11

    Your school has a problem of managing movements of goods and people in and outside of the school as this is currently done manually by using a registry book which is not easy to read.

    Develop an Access database system called GATE MANAGEMENT SYSTEM in all that pass by the get is registered and all that gets out of it is marked.

    1. The system will be able to show in real time the number of students, teachers and administrative staff in the school and those who are absent in working hours.

    2. It will also be able to show the number of items like hoes available in the school (as these passed by the gate when they were brought in the school)

    End Unit Assessment 1

    Question 1.

    The database below is composed of two tables. Use it to answer the asked questions

    n

    n

    i) What is the primary key for each table and give the reasons.

    ii) Identify the foreign key in the BOOKS table.

    iii) Identify the candidate keys in both tables.

    iv) Identify the relationship between BORROWERS and BOOKS tables and draw the E-R diagram.

    v) Does the BOOKS table respect the referential integrity rule? Why or why not ?

    Question 2.

    A company database needs to store information about employees (identified by ssn, with salary and phone as attributes), departments (identified by dno, with dname and budget as attributes), and children of employees (with name and age as attributes). Employees work in departments; each department is managed by an employee; a child must be identified uniquely by name when the parent (who is an employee; assume that only one parent works for the company) is known. We are not interested in information about a child once the parent leaves the company.

    Draw an ER diagram that captures this information.

    Question 3.

    a) Is the above table normalized? Explain your answer?

    n

    b) Explain the anomalies found in the table?

    c) Normalize the table as required


    i)          Many to many (M:M) 
  • UNIT 2: INTRODUCTION TO WEB DESIGNING

    Key Unit Competence:

    Create a static website using HTML

    Introductory activity

    Read the following scenario and answer the related questions.

    At UMURAVA secondary school, the parents’ committee advised the school administration to have a school website on the Internet so that school information and social protection can be accessed via Internet browsers.

    b

    1. Observe the picture above and give the reasons why those people are so concentrated

    2. Suppose you have the option to choose the name of the Umurava high school website. What is the specific name, you would give to the website?

    3. Can you change or delete an information from a website? Explain your answer.

    4. Discuss the 3 advantages and disadvantages of a website

    5. Visitwww.igihe.com website and identify at least five elements to web design?

    2.1. Introduction to web designing

    Today, large corporations, medium-sized, small -scale business organizations and individual are using websites to communicate company information and manage their projects. People are now reconnecting with their friends and family members on social media such as Facebook, Twitter, Instagram, YouTube etc. In this unit, we discuss basic concepts relating to web designing such as website, web page, web application, static web page and dynamic web page. The step by step process of developing a website is also discussed here.

    2.1.1. Understanding of basic concepts

    Activity 2.1

    With a research using the internet, answer the following questions:

    1. What do you understand by the terms below?

    •  Website
    •  Web page
    •  Web application

    2. Discuss the difference between Static web page and Dynamic web page

    3. Discuss the advantages of a static web page and dynamic web page

    2.1.1.1. Key terms

    i) Website

    A website is a collection of several web pages with information on a subject that are connected together. Websites Can be easily searched using search engines like Google.

    The World Wide Web is made of many websites and each is made of many webpages.

    Advantages of a website

    Websites present the following advantages:

    •  It is an effective method to showcase products and services
    •  Developing a site helps in creating a social proof of existence
    •  Helps in branding a business and achieving business goals
    •  Allows to reach out to customers for support

    Disadvantages of a website

    • A website may crash and when this happen people who were accustomed to reaching an organization through its website seem to have lost contact with it
    •  Contact form published on a website may invite lots of unwanted spam e-mails.
    •  The information on any website might be unreliable if it is not updated regularly.

    ii) Web page

    Each single resource on the web is called a web page. A web page is a document commonly written in HTML (Hypertext Markup Language) containing more specific information that is accessible through the internet or other networks using an internet browser. A web page is hypertext document that incorporates content such as text, images, sound, video and so on.

    iii) Web application

    A Web application (Web app) is an application program that is stored on a

    remote server and delivered over the internet through a browser interface. A web

    application is a software or program which is accessible using any web browser.

    Advantages of web Applications

    Web applications are more popular because of the following reasons:

    • Compared to desktop applications, web applications are easier to maintain as they use the same code in the entire applications.
    •  Web applications can be used on any platform: Windows, Linux, Mac… as they all support modern browsers
    •  Released any time and in any form. No need to remind users to update their applications.
    • They can be accessed 24 hours of the day and 365 days the year from any computer.
    •  A computer or a mobile device can be used to access the required data.

    Disadvantages of web Applications

    •  Security is not guaranteed, so it is vulnerable for unauthorized access
    •  The web app may not support multiple browsers with equal precedence

    The web application is built explicitly for a certain operating system, so it is difficult to discover from the app store.

    •  Limited scope to access the device’s features.

    Below are the prime difference between web application and website:

    b

    n

    iv) Static web page

    A static webpage is one whose contents do not change, or at least do not change quickly. A static page is one that is usually written in plain HTML and what is in the code of the page is what is displayed to the user. These are webpages that contain information that does not need to be updated. They are always the same unless the content is changed physically on the server’s hard disk. That is the reason these web pages are known as static web pages.

    Static web pages are simple and stored in a web server. Whenever server receives a request regarding a web page, it sends a response along with the requested web page to the client without performing any additional processing.

    It just locates that page on its hard disk and add HTTP headers and reply back an HTTP response.

    n

                     Figure 2.1: Web Browser Web Server interaction for Static Web Page

    The particular thing in a static web page is that the content in these types of the web page does not change depending on the request.

    v) A dynamic webpage

    A dynamic webpage is one whose contents do change, and generally change very quickly.

    For example: The website for a newspaper changes constantly because the news changes constantly.

    If the information were never updated, users would stop visiting the sites.

    Therefore, dynamic web pages provide a solution for the static web pages. The dynamic web page content can vary depending on the number of parameters.

    As it is discussed above that dissimilar to static web age, it not just simply sends HTML page in response. 

    The web server calls a program located on the hard disk which can access a database, perform transaction procedure. If the application program produces HTML output, which is used to construct an HTTP response by the web server. The web server sends the HTTP response thus created, back to the web browser.

    The dynamic web pages are employed where the information changes very often such as stock prices, weather information, news and sports updates. Let’s assume a person has to physically change the Web page every 10 seconds to

    show the latest update of the stock prices which is impractical to physically alter the HTML pages very often, so in this case, a dynamic web page can be used.

    b

    There are several tools used for the creation of dynamic web pages. For example, PHP (Personal Home Page), CGI (Common Gateway Interface), ASP (Active Server Pages), JSP (Java Server Pages), AJAX (Asynchronous JavaScript and XML), etc.

    Key differences between static and dynamic web pages

    b

                          Table 2.2: Static web pages and Dynamic web pages comparison

    Conclusion

    There is no involvement of application program in the static web page whereas dynamic web page involves an application program which can perform the various operations. Although, static and dynamic web pages have to return

    HTML contents to the web browser with the use of HTTP protocol, in order to interpret and display them on the browser.

    2.1.1.2. Importance of using both static and dynamic web pages

    A. Advantages of static websites

    •  Faster speed: Being a static file when a user visits a page, all the web server has to do is return a file. No server-side code is executed. Differently with dynamic websites there is extra processing time required to deliver HTML pages.
    • More secure: Since there is no back-end server-side processing, there is less surface area for attacks and there is no database available to be compromised.
    •  Lower cost: As they don’t have a database, static websites require less maintenance and are cheap to host.
    •  Easier to scale: When a website is hosted on the Cloud it is ready to be scaled at any time. Although similar techniques can be applied with dynamic websites, it will be more complex as database scaling might be required.
    •  Backups/Full editorial history: It is possible to see who changed which content and when if version control tools such as GIT are used.

    B. Advantages of dynamic websites

    •  Easier to update content: Using a CMS (Content Management System) web interface for managing content will allow to make changes easily.
    •  More flexible: When creating a dynamic website, the programmer have full control of the wheel to create whatever interactive feature needed.

    Application activity 2.1

    1. Discuss different characteristics of a website and web application?

    2. Define a web application and give two examples of web application?

    3. Among web application and web site, what is the advantageous? Explain your answer.

    4. With comparison table, differentiate static web page to dynamic web page

    5. Discuss reason why it is easier to update dynamic web site compared to static website.

    6. Is it very cheap to host static website in comparison with dynamic website? Explain.

    2.2. Introduction and evolution of HTML

    Activity 2.2

    Using internet, find the answers to the following questions:

    1. Write in full the abbreviated terms bellows:

          a) WWW

          b) HTML

     2. Explain what it is WWW

    3. Discuss the importance of HTML

    4. Discuss and write an essay on how Hypertext Markup Language (HTML) had evolved from 1991 to the current trends seen today.

    2.2.1 Introduction to HTML

    The World Wide Web is an Internet-based system or platform that allows hypertext documents to be interconnected by hyperlinks. A hyperlink is a word or phrase a user can click to move from one website or webpage to another.

    Hypertext enables you to read and navigate text and visual information in a nonlinear way based on what you want to read next. The idea behind hypertext is that instead of reading text in a linear structure like in a book, you can easily jump from one point to another based on interests.

    Hypertext Markup Language (HTML) refers to a language used to structure hypertext (web) documents for presentation on the World Wide Web. HTML is not a programming language but can be thought of as a presentation language used to instruct the browser on how to present text and multimedia content on the Web.

    HTML is the standard markup language for creating Web pages.

    2.2.2 Evolution of HTML

    The HTML was invented by Tim-Berners Lee, the founder of World Wide Web.

    Lee’s original HTML version was based on a more complicated document processing language known as Standard Generalized Markup Language (SGML). Soon, Lee released different versions of HTML causing incompatibilities between different developers using different versions. For this reason the following was done:

    • A consortium known as World Wide Web Consortium (W3C) was established to standardize HTML.
    • The first standard version of HTML that was developed and maintained by W3C was HTML 2.0 released in 1995. It specifies a set of tags that must be supported by all browsers.

    In 1996, release of HTML 3.2 standard then later HTML 4.0 in 1997.

    •  Most web browsers today support variation of HTML known as Extensible

    Hypertext Markup Language (XHTML) that support mobile web application too.

    •  Today, there is HTML5 which many browsers and developers are using to develop web applications.

    Application activity 2.2

    1. HTML is not a programming language but can be thought of as a presentation language. Explain.

    2. What is the difference between Hypertext and Hyperlink?

    3. What are the particularities of XHTML over HTML 4.01?

    4. Discuss the advantages of HTML 5 comparing to the previous HTML versions.

    2.3. HTML tags and syntax

    Activity 2.3

    1. What is a HTML tag?

    2. Give the syntax of a HTML tag

    3. What is the role of an attribute of a HTML tag?

    HTML tags are element names surrounded by angle brackets or Less Than and Greater Than symbols (< >).

    Syntax: <tag_name>content goes here...</tag_name>

    Example: <title> login page<title>

    •  HTML tags normally come in pairs like <p> and </p>
    •  The first tag in a pair is the start tag, the second tag is the end tag
    • The end tag is written like the start tag, but with a forward slash inserted before the tag name.

    Note: The start tag is also called the opening tag, and the end tag the closing tag.

    For example, to instruct a browser to present text as a paragraph, use the <p> opening and </p> closing tags as follows:

    <p> This is a new paragraph separated from others by a blank line</p>

    An attribute is used to define the property or characteristics of an element inside the element’s opening tag. All attributes are made up of two parts: name and value. For example, a paragraph may be right aligned using align attribute as follows:

    <p align=” left “This is left aligned</p>

    Application activity 2.3

    1. Discuss the syntax of an HTML tag

    2. Define an attribute

    3. You are given the HTML statement below: <font color=” green “> Hello Rwanda </font>

    What is the function of

    a) Color

    b) Green

    2.3.1 HTML Syntax and HTML Page Structure

    Activity 2.4

    Open notepad on your computer and type the below code.

    <! DOCTYPE html>

    <html>

    <head>

    <Title>My First Page</title>

    </head>

    <body>

    <h1> This is my first web page </h1>

    </body>

    </html>

    1. Save the above program as “myfirstpage.html”

    2. Open the myfirstpage.html using any browser.

    HTML tags are used to define a set of common web page features such as titles, paragraphs, and lists, tables, forms, images and multimedia.

    Below is a visualization of a HTML page structure:

    <html>

    <head>

    Document header related tags

    </head>

    <body>

    Document body related tags

    </body>

    </Html>

    Example: the following sample HTML code creates a web page that displays

    “VISIT RWANDA Web Page”:

    <! DOCTYPE html>

    <html>

    <head>

    <title>Page Title</title>

    </head>

    <body>

    <h1>VISIT RWANDA Web Page</h1>

    </body>

    </html>

    Explanation of above sample HTML code:

    •  The <DOCTYPE html> declaration defines the document type to be HTML5; there are many other declaration types which can be used in HTML document depending on which versions of HTML that are being used.
    •  The <html> element is the root element of a HTML page
    •  The <head> element contains meta information about the document
    • The <title> element specifies a title for the document
    •  The <body> element contains the visible page content
    •  The <h1> element defines a large heading
    •  The <p> element defines a paragraph

    Application activity 2.4

    1. Why does <DOCTYPE html> start every web page in HTML?

    2. Give HTML tags found between <head>……</head> tags

    3. Create a web page that displays your name and the name of your school?

    2.4 Design a static web page using html tags and hyperlinks

    Activity 2.5

    Using Notepad, Type the below html code and execute them.

    <html>

    <head>

    <title>Republic of Rwanda </title>

    </head>

    <body>

    Visit the official Website of the Republic of Rwanda using the link below

    <br>

    <a href=”http://www.gov.rw/home/”> The official Website of the Republic

    of Rwanda </a>

    </body>

    </html>

    Do the followings:

    1. Save the program as “linkage.html”

    2. Check if there is a linkage between your Webpage and the official website of the Republic of RWANDA.

    The editor that is going to be used for designing web pages is Notepad. This

    editor is preferred in that it requires writing from scratch every html code and

    does not provide suggestions, error correction, etc and this is good for a learner

    as it ensures mastery of all the used codes.

    Step 1: To open Notepad in Windows 10

    Click on the Start and type Notepad in the start search box

    Step 2: Write HTML into Notepad. The text below is to create a HTML page

    <! DOCTYPE html>

    <html>

    <head>

    <title>First page</title>

    </head>

    <body>

    <h1>VISIT RWANDA Web Page</h1>

    </body>

    </html>

    Step 3: Save the HTML Page

    Select File tab then Save or Save as in the Notepad menu.

    Name the file “index.htm” or any other name ending with htm.

    You can use either .htm or .html as file extension as these two extensions are the same.

    Step 4: View HTML Page in a web browser (Mozilla Firefox, internet explorer, Google chrome.)

    n

    HTML Links - Hyperlinks

    HTML links are hyperlinks. You can click on a link and jump to another document.

    When you move the mouse over a link, the mouse arrow will turn into a little hand.

    •  Note: A link does not have to be text. It can be an image or any other HTML element.

    HTML Links - Syntax

    Hyperlinks are defined with the HTML <a> tag:

    <a href=”url”>link text</a>

    Example:

    <a href=”https://www.rra.gov.rw”>Visit Official Rwanda Revenue website </a>

    Application activity 2.5

    Open the notepad software, Write an HTML page that displays your name and save it as “exercise.html” on desktop of your computer and then run the file using any browser you want.

    2.4.1. Tags that identify and name documents

    Activity 2.6

    Using Notepad text editor, write the following HTML code and save the file as mypage.html, then run the file in a browser you want.

    <! DOCTYPE html>

    <html>

    <head>

    <title>Identifying elements</title>

    </head>

    <body>

    <strong>Rwanda is known as a country of thousand hills! </strong> <br>

    <mark>The development of Rwanda is based on its people</mark><br>

    <del>strong and mark are HTML tags that organize web page contents</

    del><br>

    </body>

    </html>

    Study carefully the output of the above HTML code and answer the following

    questions:

    1. What is the function of:

    •  <strong> tag
    •  <mark> tag
    •  <del>tag

    2. Give HTML tags for changing text color and for inserting a picture HTML language specification defines the markup that can be used to create a webpage, the webpage author decides which elements they will use to  markup content.

    For example,

    a) The appearance (formatting) tags

    A document heading may be created by making text larger, bold and with a different color. Presentational markup for such a heading may look like this:

    <p>

    < font size=”36” color=”red” > <b>ICT is a key of development </b>

    </font> </p>

    Formatting elements were designed to display special types of text:

    The table below shows html text formatting elements:

    n

    Example: The HTML document below shows how to use formatting HTML elements

    <!DOCTYPE html>

    <html>

    <head>

    <title>Formatting elements</title>

    </head>

    <body>

    <mark><b>Rwanda has 4 provinces and Kigali City</b></mark> <br>

    <strong>Kigali City has 3 districts</strong><sup> which ones?</sup><br>

    <del>Kigali Convention Center is in Nyarugenge district</del><br>

    <ins>Thank you! </ins>

    </body>

    </html>

    The web page below is displayed by the above HTML document:

    n

    b) Heading tags

    Heading tags are used in the body section to define section

    headings that stand out from the rest of the text. HTML provided six levels of section headings: <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>.

    Note that the size of the heading reduces progressively with h1 being the largest while h6 is the smallest.

    The general syntax of heading element is:

    <headlevel> text</heading level>

    Example:

    The following HTML document displays the six heading levels (h1 to h6)

    <!DOCTYPE html>

    <html>

    <head>

    <title>Heading Example</title>

    </head>

    <body>

    <h1>This is heading 1</h1>

    <h2>This is heading 2</h2>

    <h3>This is heading 3</h3>

    <h4>This is heading 4</h4>

    <h5>This is heading 5</h5>

    <h6>This is heading 6</h6>

    </body>

    </html>

    The figure below shows how the headings appear when displayed on a browser

    such as chrome or Mozilla Firefox.

    n

    c) HTML images

    One of the most compelling features of latest HTML standard is the ability to embed images that make a website more attractive. The three types of images supported by HTML4 are GIF (Graphics Interchange Format), JPEG (Joint

    Photographic Experts Group) and PNG (Portable Network Graphics). To insert an image onto a web page, use the <img> tag; img is an abbreviation of the word image. The <img> is an empty tag does not require a corresponding closing tag. The general syntax for inserting a graphical object or image is:

    <img src=”Image URL” ... attributes-list/>

    The src in the img tag is an important attribute that specifies the location (source)

    or URL of the image to insert onto the page.

    For example, The following HTML code displays an image called Volcano:

    <!DOCTYPE html>

    <html>

    <head>

    <title> Visit Rwanda </title>

    </head>

    <body>

    <p><Strong><font color=”red” size=48>

    Visit Volcanoes National Park</font></strong></p>

    <center><img src=”volcano.png”alt=Gorilla in Rwanda” />

    </center>

    </body>

    </html>

    The HTML document above produces the following output:

    b

    NB: use of the alt attribute is a good practice to specify alternate text for an image, if the browser cannot display or locate the image.

    •  Setting Image size

    It is possible to specify the size using width and height attributes. The two attributes set width and height of the image in terms of pixels or percentage of its actual size. For example, to set the size of the volcano.png to occupy quarter of the screen, use:

    <img src=”volcano.png” width = “ 80%” height=”90%”alt=”Gorilla in Rwanda” />

    •  Image Alignment

    The <img> tag uses the align attribute to align an image on top, bottom, left or right of the browser window. For example, to align the volcano.png on top of the page, use align attribute as follows:

    <img src=”volcano.png” align=” top”alt=”Gorilla in Rwanda” />

    Notice: with HTML it is possible to set page background color; bgcolor attribute is used within body element.

    For example, the following html code explains how bgcolor attribute is used

    while setting yellow color as the page background.

    <! DOCTYPE html>

    <html>

    <head>

    <title>First page</title>

    </head>

    <body bgcolor=”yellow”>

    <h1><font color=”red” size=”72”>This page has a yellow color as page

    background! </h1>

    </body>

    </html>

    The above html document displays the following web page in a browser:

    n

    Application activity 2.6

    1. Using heading, paragraph, font and image elements create a page that briefly describes a topic that you would like to cover in your small website

    known as a blog. The website should contain information such as :

        a) Description about yourself,

        b) academic profile,

        c) Career aspirations in separate paragraphs

        d) Insert your own photo.

    2. Discuss the function of the following attributes in <font> tag:

        a) Color attribute

        b) Size attribute

    3. Explain the role of src, alt, and align attributes within <img>tag

    2.4.2. Tags that organize web page contents

    In this section, we discuss some HTML elements that describe the structure and organize web contents.

    A. HTML lists: Ordered and Unordered list

    Activity 2.7

    1. Type and execute the HTML code below, observe the output and explain the way page content is organized.

    <! DOCTYPE html>

    <html>

    <head>

    <title>list</title>

    </head>

    <body bgcolor=”yellow”>

    <p><Strong> Districts of KIGALI City</strong></p>

    <ol >

    <li>Gasabo</li>

    <li>Nyarugenge </li>

    <li>Kicukiro</li>

    </ol>

    </body>

    </html>

    The information can be displayed in numbered or bulleted list. HTML supports

    three types of lists namely ordered list, unordered list, and definition list.

    •  Ordered <ol> list is a container for enumerated items ordered using numbers such as 1, 2, 3.
    •  Unordered list <ul> is a collection of related items that have no special order or sequence.
    •  Definition list <dl> is used for definitions such as glossaries that pair each label with some kind of description.
    •  Creating ordered list

    To create an ordered list, use the <ol>...</ol> tags within which to include one or more <li>...</li> (list item) tags.

    Example:

    <!DOCTYPE html>

    <html>

    <head>

    <title>Numbered List</title>

    </head>

    <body>

    <p><Strong><font color=”red” size=72>

    Easter African Community(EAC) has 6 Partner States:</font></strong></p>

    <ol >

    <li>Rwanda</li>

    <li>Uganda</li>

    <li>Burundi </li>

    <li>Kenya</li>

    <li>Tanzania</li>

    <li>South Sudan</li>

    </ol>

    </body>

    </html>

    The figure below shows the ordered list of 6 <li> countries after displaying the page on a browser

    b

    It is possible to customize the numbering style of an ordered list using the type

    attributes as follows:

    <ol type = “counter-type”>....</ol>

    Examples

    <ol type = “a”> ...</ol>

    <ol type = “i”> ...</ol>

    •  Creating unordered list

    Unordered list is similar to ordered list only that the items are listed using

    bullets. To create unordered list, use <ul>...</ul> instead of <ol>..</ol> element

    Example:

    <!DOCTYPE html>

    <html>

    <head>

    <title>Unordered List</title>

    </head>

    <body>

    <p><Strong><font color=”purple” size=72>

    Rwanda currently has 3 National Parks:</font></strong></p>

    <ul >

    <li>Volcanoes National Park Rwanda</li>

    <li>Nyungwe Forest National Park</li>

    <li>Akagera National Park </li>

    </ul>

    </body>

    </html>

    The Figure below shows the unordered list of 3 Rwanda National Parks when the page is opened using a web browser:

    b

    It is possible to customize unordered lists using type attribute and values that denote bullet types such as disc, square, or circle. For example, to change the bullets displayed in above figure from round to square, use the following syntax:

    <ul type = “bullet-type”>....</ul>

    For example, to display unordered list shown in figure above as a square, bullets, use the style attribute as follows:

    <ul type = “square”> ..</ul>

    Application activity 2.7

    Study the following HTML document and answer related questions:

    <! DOCTYPE html>

    <html>

    <head>

    <title>list</title>

    </head>

    <body bgcolor=”yellow”>

    <p><Strong> ICT Contents of Year one:</strong></p>

    <ul >

    <li>Unit 1: introduction to XO laptop </li>

    <li>Unit 2: Computer maintenance </li>

    <li>Unit 3: Advanced word processing </li>

    <li>Unit 4: Advanced Spreadsheet I </li>

    <li>Unit5: Searching the internet I </li>

    </ul>

    </body>

    </html>

    1. Write and execute the above html code then specify the type of a list

    2. Write the same html code and change it into unordered list using square bullet types.

    B. HTML lists: Definition and Nested lists

    Activity 2.8

    n

    1. How do you call a list which is written inside another list?

    2. Using HTML code , write the above list

    i) Creating definition list

    A definition list is used to present a glossary of terms, or other definition lists like

    Dictionary and encyclopedia. To create a definition list, use <dl> ...</dl>

    element in which you place <dt> ... </dt> to mark up the term and <dd> ... </ dd> to mark up the definition part.

    Therefore a definition list consists of the following parts:

    •  <dl> - Defines the start of the list
    •  <dt> - A term
    •  <dd> - Term definition
    •  </dl> - Defines the end of the list

    For example, the following HTML document shows a definition list of four terms:

    <!DOCTYPE html>

    <html>

    <head>

    <title>Definition list </title>

    </head>

    <body>

    <dl>

    <dt><b>ICT </b></dt>

    <dd>ICT stands for Information and Communication Technology</dd>

    <dt><b>HTML</b></dt>

    <dd> HTML stands for Hyper Text Markup Language</dd>

    <dt><b>JPEG</b></dt>

    <dd>JPEG stands for Joint Photographic Experts Group</dd>

    <dt><b>CSS</b></dt>

    <dd>CSS stands for Cascading Style Sheet</dd>

    </dl>

    </body>

    </html>

    n

    ii) Creating nested lists

    To create a nested list, put the entire list structure inside another list

    Example:

    <!DOCTYPE html>

    <html>

    <head>

    <title>sample Nested List </title>

    </head>

    <body>

    <p><Strong><font color=”blue” size=48>

    ICT content for TTC year 2 and 3:</font></strong></p>

    <ol type=”i”>

    <li> Advanced Spreadsheet II </li>

    <li> Advanced power point presentation </li>

    <li> Computer Graphics tools </li>

    <li> E commerce, social media and online services </li>

    <li> Database creation and manipulation </li>

    <ul type=”circle”>

    <li>Key terms used in Database </li>

    <li> Data type </li>

    <li>Opening, saving and closing a database </li>

    <li>Create a blank database </li>

    </ul>

    </li>

    <li>Introduction to web designing </li>

    <ol type=”a”>

    <li>Introduction to web designing </li>

    <li> Introduction to HTML </li>

    <li>Importance of using both static web page and dynamic web page </li>

    <li>Design a static web page using html tags and hyperlinks </li>

    <li> Creation of links </li>

    <li> Website creation project </li>

    </ol>

    </ol>

    </body>

    </html>

    b

    Application activity 2.8

    1. Give a clear difference between:

    i) Definition and Nested list

    ii) <dt>…</dt> and <dd>…</dd> tags

    2. Study the following web page and then write its HTML code which displays it into browser.

    n

    C. HTML Frame and Table tags

    Activity 2.9

    1. A web page or a web browser can be divided into different parts so that each part can display content independent of its container. How can you name that part?

    2. Write HTML code that display the below table

    n

    •  HTML Frame Tags

    In the context of a web browser, a frame is a part of a web page or browser window which displays content independent of its container, with the ability to load content independently. The HTML or media elements that go in a frame may or may not come from the same web site as the other elements of content on display.

    Frameset:

    In HTML, a frameset is a group of named frames to which web pages and media can be directed.

    The attributes rows and cols on the opening frameset tag define the dimensions of a grid of frames using comma-separated lists of sizes, specified in either pixels or percentages. Within the frameset, a series of frame elements describe the initial source documents for each frame in the frameset, as well as assigning them names for use as the target of links.

    Note that a HTML document would normally contain a head and a body may instead contain a head and a frameset (but not both a body and a frameset).

    Example: the HTML document below, is creating three horizontal frames:

    <! DOCTYPE html>

    <html>

    <head>

    <title>Frames</title>

    </head>

    <frameset rows=”25%,40%,35%”>

    <frame name=”top” src=”Unordered.html” />

    <frame name=”main” src=”Visit.html” />

    <frame name=”bottom” src=”Easter_Africa.html” />

    </frameset>

    </html>

    The above html code will produce the following result:

    b

              Figure 2.12: HTML Frames

    •  HTML Table tags

    Tables are used to organize data such as numbers, text, links and images into rows and columns. An intersection of a row and a column forms data cell in which table data is held

    The HTML tables are created using the <table> tag which is a container for <tr> (table row) tag used to create rows and <td> (table data) tag used to create data cells.

    Before creating a table, consider the following table-features:

    •  Caption: indicates the type of data presented in the table
    •  Table headings: the row that indicate the data displayed in each column
    • Table cells intersection of rows and columns in which we insert data
    • Table data is the data or values in the table

    To create a table, we use the <table>…</table> element within which the following elements are nested:

    •  <caption>…</caption> used to create the table caption
    •  <th> ...</th> tag is used to create the table heading
    •  <tr>...</tr> tag is used to create table rows
    •  <td>...</td> tag is used to create data cells

    Notice that the table starts with a <table> tag followed by border, cell padding and cell spacing attributes and ends with the closing </table> tag.


    For example: the following HTML code produces the table

    <!DOCTYPE html>

    <html>

    <head>

    <title>Table </title>

    </head>

    <body>

    <table border=”2” cellpadding=”3” cellspacing=”3”>

    <Caption><b> UMUCYO HOTEL EMPLOYEE’S DATA</b></caption>

    <tr>

    <th>Employee Name</th>

    <th>Department</th>

    <th>Salary</th>

    </tr>

    <tr>

    <td>Paul KAMANA</td>

    <td>Finance </td>

    <td>250000</td>

    </tr>

    <tr>

    <td>Dhalie NIZEYIMANA</td>

    <td>Marketing</td>

    <td>200000</td>

    </tr>

    <tr>

    <td>Jean Claude UWIHANGANYE</td>

    <td>Information Technology </td>

    <td>400000</td>

    </tr>

    </table>

    </body>

    </html>

    The HTML document above produces the following table:

    v

                    Figure 2.13: Sample HTML table

    The following are basic attributes used to define or format a HTML table:

    a) Border Attribute

    The border attribute takes numeric values that specify thickness of the border that surrounds all the table cells. If 0 is used, the border is invisible while. In our example above, the statement below creates a border of 2-pixel thickness.

    <table border=”2” >

    b) Height and Width attributes

    To set the size of the table, use width and height attributes. The height and width attributes take width or height values in terms of pixels or percentage of the screen. For example, the statement below sets the table size to width of 400 pixels and height of 150 pixels.

    <table border=”2” width=”400” height=”150”>

    c) Cellpadding Attribute

    The cellpadding attribute specifies the space, in pixels, between the cell wall and the cell content.

    Note: Do not confuse this with the cellspacing attribute, which specifies the space between cells.

    Syntax: <table cellpadding=”pixels”>

    d) Cellspacing Attribute

    The cellspacing attribute specifies the space, in pixels, between cells.

    Syntax: <table cellspacing=”pixels”>

    Note: The cellspacing attribute of <table> is not supported in HTML5.

    Pixels are the space between cells.

    e) Table Caption

    The caption tag will serve as a title or explanation for the table and it shows up at the top of the table. However, it is important to note that the caption tag is deprecated in newer versions of HTML.

    f) Colspan attribute

    The colspan attribute in HTML specifies the number of columns a cell should span. It allows the single table cell to span the width of more than one cell or

    column. It provides the same functionality as “merge cell” in the spreadsheet program like Excel.

    Usage: It can be used with <td> and <th> element while creating a HTML table.

    <td>: The colspan attribute when used with <td> tag

    determines the number of standard cells it should span.

    Syntax:

    •  <td colspan =”value”> table content...</td>
    • <th>: The colspan attribute when used with <th> tag

    determines the number of header cells it should span.

    Syntax:

    • <th cospan =”value”> table content...</th>
    •  The value specifies the number of columns that the cell fills. The value must be an integer

    g) Rowspan attribute

    The rowspan attribute in HTML specifies the number of rows a cell should span.

    That is if a row spans two rows, it means it will take up the space of two rows in that table. It allows the single table cell to span the height of more than one cell or row. It provides the same functionality as “merge cell” in the spreadsheet program like Excel.

    Usage: It can be used with <td> and <th> element in a HTML table.

    •• <td>: The rowspan attribute when used with <td> tag

    determines the number of standard cells it should span.

    Syntax:

    •• <td rowspan = “value”> table content...</td>

    •• The value specifies the number of rows that the cell fills. The value must

    be an integer.

    • <th>:The rowspan attribute when used with <th> tag

    determines the number of header cells it should span.

    Syntax:

    •  <th rowspan = “value”>table content...</th>
    •  The value specifies the number of rows that the cell fills. The value must be a integer.

    Example: The following HTML code explains how to use HTML table attribute discussed above:

    <!DOCTYPE html>

    <html>

    <head>

    <title>Table attributes </title>

    </head>

    <body>

    <table border=”4” cellpadding=”3” cellspacing=”3”

    width=”400”height=”200”>

    <Caption><b> ECOLE SECONDAIRE DE MUHAMBARA</b></caption>

    <tr>

    <th colspan=6> Number of studens in E.S.M</th>

    </tr>

    <tr>

    <th colspan=2> O’level</th>

    <th colspan=2> A’level</th>

    <th colspan=2> Total number</th>

    </tr>

    <tr>

    <th>Boys</th>

    <th>Girls</th>

    <th>Boys</th>

    <th>Girls</th>

    <th rowspan=”2”>605</th>

    </tr>

    <tr>

    <td>120</td>

    <td>200</td>

    <td>130</td>

    <td>155</td>

    </tr>

    </table>

    </body>

    </html>

    The above HTML code produces the output below:

    b

                                      Figure 2.14: HTML table attributes

    Application activity 2.9

    1. Discuss the use of the following tags and attributes:

          a) <Frameset> tag

          b) <Caption> tag

          c) Colspan attribute

          d) <Th> tag

    2. Create an html document which create a web page with three frames named: “Top_Frames “,”Main_Frames “,and “Bottom_Frame”.

    3. Using HTML tags , create a web page that display the below table

    v

    b

    D. HTML Forms

    Activity 2.10

    A website is developed with different pages using HTML language. Observe it and answer related questions.

    n

    1. What do you understand a HTML form?

    2. What is the use of HTML form?

    3. Use HTML code to produce the above page

    A person may need to gather information such as student’s details and store such information in the server. The most common method for gathering such information is by using a form.

    When users fill forms and clicks the submit button, the data keyed into the form is sent (posted) to the web server for processing or storage into a database.

    To create HTML forms, we use the <form> ... <form> element as follows:

    <form action=”Script URL”method=”GET|POST”>

    form elements like input, textarea etc.

    </form>

    HTML forms contain form elements (form controls). There are different types of form controls that can be used to facilitate data collection information using HTML form. The most common controls include: text, textarea, select, radio buttons, checkboxes, file select, command button and reset buttons.

    Let see the use of every form element and basic form attributes

    a) Form Action Attribute

    The <form> tag takes several attributes key among them the action and method attributes used to accomplish the following:

    The action attribute is used to specify the file on the server that receives data from the form for processing. For example, the action attribute in the form tag below specifies a file named register.php that receives registration details after the user clicks the submit button:

    <form action=“register.php”> </form>

    b) Form Method Attribute

    The Method attribute specifies how the data is to be sent to the web server.

    The method attribute specifies the HTTP method (GET or POST) to be used when submitting the forms:

    Get Method: If a “GET” method is used, the data supplied in the form is appended at the end of the URL.

    Note that using Get method in login form is not recommended because unauthorized users may see actual username and password.

    Post Method:

    Unlike the GET method, post method does not display submitted form data on URL because the parameters are passed as body of a HTTP request.

    Use POST if the form is updating data, or includes sensitive information (password). POST offers better security because the submitted data is not visible in the page address.

    The <input> Element

    The <input> element is the most important form element. 

    The <input> element has many variations, depending on the type attribute.

    c) Text input

    Input control is used to capture alphanumeric data such as text.

    <input type=”text”> defines a one-line input field for text input. For example,

    the following statement defines text input for capturing First name:

    First name: <input type=“text” name=“first” size = “20” />

    This is how the HTML code above will be displayed in a browser:

    n

    d) Hidden input

    Sometimes it is important to conceal the identity of information entered in the

    form using the input type. This is achieved by use of hidden input type. To create

    hidden input, set the input type to hidden as shown below:

    <input type=“hidden” name=“userid” value=“321”/>

    e) Password input

    <input type=”password”> defines a password field:

    Example:

    <form>

    User name:<br>

    <input type=”text” name=”username”> <br>

    User password:<br>

    <input type=”password” name=”psw”>

    </form>

    The HTML code above will display the following:

    b

    After typing a user name and pass word, input boxes will look like the following:

    n

    f) Text area

    Text area control is a multi-line text input used when the user is required to give details that may be longer than a single sentence.

    The attributes used with textarea tag are: name, rows, and cols.

    For example, the following statement defines textarea named comment that has

    6 rows and 10 columns:

    <form >

    Comments: <br > <textarea rows=”7”cols=”25”name=”comment”></

    textarea>

    </form>

    This is how the HTML code above will be displayed in a browser:

    n

    g) Checkbox

    Checkbox controls are input type used when more than one option is required

    to be selected from a list of check boxes. However, the input type attribute must

    be set to checkbox value as shown by the following statements:

    <! DOCTYPE html>

    <html>

    <head><title>checkbox</title>

    </head>

    <body>

    <P><Strong><font color=”orange” size=36>Choose your favorite games</

    font></strong></p>

    <form>

    <p><input type=”checkbox” name=”game” checked=”checked”> Football </

    p>

    <p><input type=”checkbox” name=”game” > Basketball <p>

    <p><input type=”checkbox” name=”game” > Volley Ball<p>

    <p><input type=”checkbox” name=”game” > Net Ball<p>

    </form>

    </body>

    </html>

    b

                      Figure 2.15: HTML Checkbox input type

    h) Radio button

    Radio buttons let a user select ONLY ONE of a limited number of choices.

    <input type=”radio”> defines a radio button.

    Example:

    <!DOCTYPE html>

    <html>

    <head><title>radio buttons</title>

    </head>

    <body>

    <p><strong><font color=”orange” size=36>select your sex</font></

    strong></p>

    <form>

    <input type=”radio”name=”sex” value=”male”checked=”checked” > male </

    br>

    <input type=”radio”name=”sex” value=”female””>female </br>

    </form>

    </body>

    </html>

    The HTML code above will be displayed in a browser as follows:

    h

                                     Figure 2.16: HTML Radio input type

    i) Select or (Drop-Down List)

    The select control also known as dropdown box provides the user with various

    options in form of drop down list, from which a user can select one or more

    options. For example, the following select defines a dropdown for selecting only one option:

    <! DOCTYPE html>

    <html>

    <head><title>dropdown list</title>

    </head>

    <body>

    <p><strong><font color=”pink” size=36>

    Select your residence province:</font></strong></p>

    <form>

    <select name=”dropdown”>

    <option value=”Kigali” selected>Kigali City</option>

    <option value=”South”>South Province</option>

    <option value=”North”>North Province</option>

    <option value=”Easter”>East Province</option>

    <option value=”West”>West Province</option>

    </select>

    </form>

    </body>

    </html>

    The HTML document above produces the following webpage:

    x

    When you click on drop down arrow of a box, it will be as follows:

    j) Submit and Reset Button

    Submit input type used to create a button that automatically submits form data to web server. On the other hand, reset is used to refresh (reset)form controls to their default values. The following statements creates submit and reset buttons with values set to Send and Reset respectively:

    <form>

    <input type=”submit”name=”submit” value=”Send” />

    <input type=”reset” name=”reset” value=”Reset” />

    </form>

    This is how the HTML code above will be displayed in a browser:

    n

    The following is a HTML document that implements input text box, input password box, checkbox, radio buttons, select, text area and action buttons

    (Submit and Reset)

    <!DOCTYPE html>

    <html>

    <head><title>Detailed Form Page</title>

    </head>

    <body>

    <h2><Font color=”green” size=36>Please provide your registration details

    </font></h2>

    <form action=”register.php”method=”post”>

    <p><b>Your first name:</b><input type=”text” name=”first”size=20></p>

    <p><b>Your second name:</b><input type=”text”

    name=”second”size=20></p>

    <p><b>Your username:</b><input type=”text” name=”mail”size=13></p>

    <p><b>Your password:</b><input type=”password” name=”pass”size=10

    ></p>

    <p></u><b>choose your interested subjects:</b></u></p>

    <input type=”checkbox” name=”check”checked=”checked”>Computer Science<br>

    <input type=”checkbox” name=”check”>Mathematics<br>

    <input type=”checkbox” name=”check”>Physiscs<br>

    <input type=”checkbox” name=”check”>Chemistry<br>

    <p></u><b>Select your sex:</b></u></p>

    <input type=”radio”name=”sex” value=”male”checked=”checked” > Male

    <input type=”radio”name=”sex” value=”female””>Female

    <p></u><b>Select your residence district:</b></u>

    <select name=”dropdown”>

    <option value=”Gasabo” selected>Gasabo District</option>

    <option value=”Nyarugenge”>Nyarugenge District</option>

    <option value=”Kicukiro”>Kicukiro District</option>

    </select></p>

    <p><b>Comments:</b><br>

    <textarea rows=”3”cols=”15”name=”comment”></textarea>

    </p>

    <p><b>If you have provided all required information click

    <input type=”submit”name=”submit” value=”Send” /></p>

    <p><b>If you want to reset your form click

    <input type=”reset”name=”reset” value=”Clear” /></p>

    </form>

    </body>

    </html>

    The above HTML document produces the following web page:

    x

    Notice:

    a) It is possible to organize the HTML form elements using a table so that they can be well arranged.

    For example, the HTML document below explains how to insert a HTML form in a table:

    <! DOCTYPE html>

    <html>

    <head>

    <title> Registration</title>

    </head>

    <body>

    <center>

    <h1> <font color=”blue”>Please provide the following details</font></h1>

    <table><form Action= “register.php” Method= “get” >

    <tr><td>First Name:</td> <td><input type= “text” name= “FName”

    size=”15”></td></tr>

    <tr><td>Last Name:</td> <td><input type= “text” name=

    “lname”size=”15”></td></tr>

    <tr><td>Nationality:</td> <td> <input type=”text”name= “country”

    size=”25”></td></tr>

    <tr><td>Phone:</td> <td> <input type= “text” name= “phone”

    size=”15”></td></tr>

    <tr><td><input type=”checkbox” name=”subjects” checked=”checked”></

    td> <td> Computer Science</td></tr>

    <tr><td><input type=”checkbox” name=”subjects” ></td> <td> Physics</

    td></tr>

    <tr><td><input type=”checkbox” name=”subjects” ></td> <td>

    Economics</td></tr>

    <tr><td><select name=”dropdown”> <option value=”maths”

    selected>Mathematics</option>

    <option value=”computer”>Computer Science</option> </select> </td></

    tr>

    <tr><td>Comments:</td> <td> <textarea

    rows=”3”cols=”10”name=”comment”> </textarea></td></tr>

    <tr><td><input type=”submit” name=”submit” value=”Send”></td></tr>

    </form></table>

    </center>

    </body>

    </html>

    The HTML code above displays the following page in a browser:

    a

    Application activity 2.10

    1. Explain the following HTML tag and attributes :

          a) Action attribute

          b) Method attribute

         c) Text area tag

    2. Write the syntax of select HTML tag

    3. Write the HTML code that displays the form below:

    f

    b) Particularities of HTML5

    Activity 2.11

    1. According to the knowledge you have about previous HTML versions, what do you think HTML5 came to solve?

    2. Discuss reasons why HTML5 has taken over other HTML versions

    3. Give examples of new input types of HTML5

    HTML5 is the fifth revised and newest version of HTML standard offering new features that support multimedia content more effectively than the previous versions.

    To be supported by majority of browsers, HTML5 has been developed in collaboration with browser makers. This explains why most browsers are supporting the new HTML5 specification.

    HTML5 provides new elements and attributes that allow for backward compatible with current and older browsers.

    HTML5 Doctype

    DOCTYPEs in previous HTML versions were longer because HTML4 and XHTML required a reference to SGML-based DTD. HTML5 standard is a radical departure from SGML restrictions to new features based on cascading style

    sheet (CSS) and Javascript. This is why doctype is a short statement written as:

    <! DOCTYPE html>

    New HTML5 Elements

    • Media elements: Due to high demand of multimedia content on the web, WC3 introduced new set of media elements in HTML5 to handle different media types without need for additional plugins such as Adobe flash. New media elements include:

    s

    •  Input elements: New input types were introduced to address specific form input and formatting requirements for user input such as dates, numbers, and telephone numbers. Examples of new input types include:

    n

    To demonstrate how the new input types and attributes are used, below is sample HTML5 document used to get text, telephone, e-mail, date, time and numbers.

    <!DOCTYPE html>

    <html>

    <head>

    <title> New HTML5 input types</title>

    </head>

    <body>

    <p><em><strong><font size=36 color=”green”>This page contains

    examples of the new input types that can be used in HTML5.

    </font></strong></em></p>

    <form action=”new_input.php” method =”post”>

    <p> User name:<input type=”text”name=”user”size=15></p>

    <p> User secreet code:<input type=”password”name=”psw”size=8></p>

    <p> Email:<input type=”email”name=”mail”size=20></p>

    <p> Your favorite website:<input type=”url”name=”site”size=20></p>

    <p> Telephone:<input type=”tel”name=”phone”size=10></p>

    <p> Your shoes size:<input type=”number”name=”num”min=5 max= 15 ></p>

    <p> Your info is submitted on:<input type=”date”name=”date”> at:<input

    type=”time”name=”time”></p>

    <input type=”submit”value=”Send”name=”button”><br/>

    </form>

    </body>

    </html>

    The above Html code displays the following in a web browser:

    N

    Note that HTML5 implements validation of data. For example, if upon an attempt to submit a wrong email or url, the browser will look for patterns to ensure a valid e-mail and url address have been entered, if it finds that wrong data was entered, the browser goes as far as presenting the user with an error. An illustration of this can be seen in the image below where a screen shows how it looks when leaving the email box with wrong data:

    X

    This short screen shows how it looks when clicking on Send button:

    S

    Application activity 2.11

    1. Give a DOCTYPE declaration of HTML5

    2. Explain how HTML5 implements validation of data?

    3. Discuss about new types bellow:

               a) Email

               b) url

               c) datetime

    4. Debate this argument by support it or giving justification why migrating from HTML4 to HTML5 is a brave decision that should not be held back due to few people who are resistant to change!

    5. Write a HTML code that creates a form that has input types below:

    •  Text
    •  Email
    •  Month
    •  Number

    2.4.3 Creation of links

    Activity 2.12

    1. A website is a collection of several web pages with information on a subject that are connected (linked) together. What do you understand by a link?

    2. What is difference between internal and external link?

    A hyperlink is a text, phrase or image that is clicked on in order to go to another web page or a section within the current page or to another website. In most browsers, hyperlinks are often in blue and underlined.

    HTML Links – Syntax

    To create a hyperlink, use the anchor element: <a>...</a>. The <a> tag is called an anchor tag because it is used to create anchors for hyperlinks.

    <a href=”url”>link text</a>

    Example:

    <a href=”http://www.irembo.gov.rw”>Irembo Official Website</a>

    The href (Hypertext Reference) attribute specifies the destination address (http://www.irembo.gov.rw”). The link text is the visible part (Irembo Official Website). 

    Clicking on the link text, will send the page visitor to the specified address.

    Note: The link text does not have to be text. It can be a HTML image or any other HTML element.

    Local Links

    The example above used an absolute URL (A full web address).

    A local (internal) link (link to the same web site) is specified with a relative URL (without http://www....).

    The following code shows how to add text-based hyperlink into a HTML page:

    <!DOCTYPE html>

    <html>

    <head>

    <title>Hyperlink page</title>

    </head>

    <body>

    <p><font color=”orange” size=”20”> For getting more information Click

    following link:

    </font></p>

    <a href=”http://www.tutorpoint.edu”>Visit Tutorial Site</a>

    </body>

    </html>

    The figure below shows how the link is displayed on the browser.

    N

    In most browsers, a hyperlink is an underlined text and blue in color. In our case, once the visitor clicks on the link, he or she is taken to the web page of the tutorial site as long as it is a valid URL.

    Example 2:

    <! DOCTYPE html>

    <html>

    <head>

    <title>Hyperlink page</title>

    </head>

    <body>

    <p><font color=”purple” size=”20”> Click following link for more information:

    </font></p>

    <a href=”frame.html”>click here</a>

    </body>

    </html>

    Output of above html code:

    B

    The click here hyperlink fall on the following frame.html page:

    B

    Application activity 2.12

    1. Define the following terms:

           a) Hyperlink

          b) Hypertext

         c) href attribute

    2. What do you understand by a local link?

    3. Explain this statement: <a href=”photo.html”> image link</a>

    4. Create two static web pages and hyperlink called “next” which links them.

    2.5 Website Creation Project

    Activity 2.13

    With research on internet, find and discuss different steps (phase) involved in the web site design and development process.

    There are numerous steps in web site design and development process from gathering initial information, to the creation of a web site, and finally to maintenance to keep it up to date and current.

    The exact process will vary slightly from designer to designer, but the basics are the same.

    1. Information Gathering

    2. Planning

    3. Design

    4. Development

    5. Testing and Delivery

    6. Maintenance

    For example, to understand actions taken into account in every phase, let have a sample and simple static website creation project for a Hotel.

    2.5.1. Phase one: Information gathering from the custom

    The first step in designing a successful web site is to gather information.

     Many things need to be taken into consideration before creating a website.

    This first step is actually the most important one, as it involves a solid understanding of the company it is created for.

    It is important that a web designer start off by asking questions to him/her understand the business process and the needs for the website to be created.

    This phase is the main focus of the project managers and stake holders.

    Meetings with managers, stake holders and users are held in order to determine the requirements like:

    a) Who is going to use the system?

    b) How will they use the system?

    c) What data should be input into the system?

    d) What data should be output by the system?

    e) These are general questions that get answered during a requirements gathering phase.

    Certain things to consider are:

    •  Purpose: What is the purpose of the site? To provide information, promote a service, sell a product…?
    •  Goals: What to accomplish by building the web site? Two of the more common goals are either to make money or share information.
    • Target Audience:

                   – Is there a specific group of people that will help in reaching the goals?

                 – It is helpful to picture the “ideal” people that will visit the new web site?

                 – Consider their age, sex or interests – this will later help determine the best design style for the new site.

    • Content: What kind of information will the target audience be looking for on your site? Are they looking for specific information, a particular product or service, online ordering…?

    With considered example, as web designer, ask a hotel owner and manager the following questions in order to get needed information:

    1. What is the name of your Hotel?

    2. Why do you want a website for your Hotel?

    3. What do you want as the name of your website?

    4. What does the new web site serve to your customers?

    5. Is there a specific group of people that will help in reaching your goals?

    6. What kind of information will the target audience be looking for on your web site?

    2.5.2. Phase Two: Planning

    After requirement gathering these requirements are analyzed for their validity and the possibility of incorporating the requirements in the system to be development is also studied.

    Using the information gathered from phase one, it is time to put together a plan for the web site. This is the point where a site map (Requirement Specification document) is developed. The site map is a list of all main topic areas of the site, as well as subtopics, if applicable. This serves as a guide as to what content will be on the site, and is essential to developing a consistent, easy to understand navigational system. The end-user of the web site must be kept in mind when designing a web site. These are, after all, the people who will be learning about your service or buying your product. A good user interface creates an easy to navigate web site, and is the basis for this.

    During the planning phase, the web designer will also help in deciding which technologies should be implemented.

    S

    ITUZE HOTEL is nearby:

    • Stade Amahoro                                                                               4 min drive
    •  Kimironko Market                                                                        10 min walk
    •  Kigali International Airport                                                        6 min drive
    •  Kibagabaga Adventist English Church                                   5 min walk
    •  Kibagabaga Hospital                                                                    10 min walk

    TECHNOLOGY: SOFTWARE AND HARDWARE

    1. Software: HTML and Notepad text editor

    2. Hardware: personal computer, digital camera, USB connector

    2.5.3. Phase Three: Design

    Drawing from the information gathered up to this point, it’s time to determine the look and feel of your site. Target audience is one of the key factors taken into consideration. A site aimed at teenagers, for example, will look much different than one meant for a financial institution. As part of the design phase, it is also important to incorporate elements such as the company logo or colors to help strengthen the identity of your company on the web site. Your designer should allow you to view your project throughout the design and development stages.

    The most important reason for this is that it gives you the opportunity to express your likes and dislikes on the site design.

    In this phase, communication between both you and your designer is crucial to ensure that the final web site will match your needs and taste. It is important that you work closely with your designer, exchanging ideas, until you arrive at the final design for your web site. Then development can begin.

                                                  Control flow of ITUZE HOTEL Web site (IHW)

    S

    2.5.4. Phase Four: Development

    The developmental stage is the point where the web site itself is created. On receiving system design documents, the work is divided in modules/units and actual coding is started. Since, in this phase the code is produced so it is the main focus for the developer. This is typically done by first developing the home page, followed by a “shell” for the interior pages.

    The shell contains the main navigational structure for the web site. The developer should continue to make you in-progress web site available to you for viewing, so that you can suggest any additional changes or corrections you would like to have done. 

    This is the longest phase of the website/software development life cycle

    Here below are HTML codes and screen shorts of main webpages of IHW: Home Page

    Home page is created by HTML code belows:

    <! DOCTYPE html>

    <html>

    <head>

    <title>HTML Frames</title>

    </head>

    <frameset rows=”25%,75%”>

    <frame name=”top” src=”top_frame.html” />

    <frame name=”main” src=”Main.html” />

    <noframes>

    <body>

    Your browser does not support frames. </body>

    </noframes>

    </frameset>

    </html>

    Above HTML code produces the following webpage: