DP Ss2 Note First Term
DP Ss2 Note First Term
1. DATA MODELS
2. DATA MODELING 2
3. DATA MODELING 3
4. NORMAL FORMS
5. NORMAL FORMS 2
7. RELATIONAL MODEL
8. RELATIONAL MODEL 2
9. RELATIONAL MODEL 3
CONTENT
The main effort during the system development life cycle (SDLC) was to produce a set of
programs that automates a business process. Processing was the key drivers for information
systems, not the data or information. As the technology and complexity of system grew,
methodologies and modelling techniques were invented to improve the quality of the
deliverables and to ensure that inexperienced programmers could follow repeatable SDLC
processes.
Data Modelling is the process of structuring and organizing data. The data structures are then
typically implemented in a database management system. In addition to defining and
organizing the data, data modelling may also impose constraints or limitations on data placed
within the structure.
Data modelling techniques and tools help to capture and translate complex system designs into
easily understood representation of data flows and processes, creating a blueprint for
construction and re-engineering.
Data Models provide a structure for data used within information system by providing specific
definition and format.
Data Model shows the dataflow and logical interrelationship among different data elements.
Compatibility of data can be achieved, if a data model is consistently used across the systems.
The term data model actually refers to two different things: a description of data structure and
the way data are organized using Database Management System (DBMS).
Data Structure: A data model describes the structure of the data within a given domain and, by
implication, the underlying structure of that domain itself.
Data Organization: A data Model also describes how to organized data using a database
management system.
1. Conceptual Data Modelling: The conceptual data modelling identifies the highest level
relationships between different entities. This is the first step in organizing
the data requirements.
2. Logical Data Modelling: The logical Data modelling illustrates the specific entities, attribute and
relationships involves in a business function. It serves as the basis for the creation of the
physical data model.
3. Physical Data Modelling: The physical Data Modelling represents an application and database-
specific implication of a logical data model and describes the physical means used to store data.
Flat Model: The flat Model (or Table) model consists of a single, two-dimensional array
of data elements, where all members of a given column are assumed to be similar in values,
and all member of row are assumed to be related to one another.
Flat Model
RECORD 1 1 – 95 12 Overlay
Network Model: This model organizes data using two fundamental construct, called records
and sets. Records contain fields, and sets define one-to-many relationships between records:
one owner, many members.
Relational Model: The relational model or relational data base model is based on first-order
predicate logic. Its core idea is to describe a database as a collection of predicates over a finite
set of predicate variables, describing constraints on the possible values and combinations of
values.
Object-Relational Model: The object relational model is similar to relational database model,
but objects, classes and inheritance are directly supported in database schemas and in the
query language. An object-relational database can be said to provide a middle ground between
relational databases and object-oriented databases (OODBMS)
Star Schema: The star schema is the simplest style of data warehouse schema. The star schema
consists of a few “fact table” (possibly only one, justifying the name) referencing any number of
dimension tables”. The star schema is considered an important special case of the snowflake
schema.
Class Task
Ticket-Out
1. In the approach of data modeling ____ data modeling illustrate the specific entities, attribute
and relationship involved in business function.
2. Conceptual Data Modeling (b) Logical Data Modeling (c) Flat data Modeling (d)
Physical Data Modeling
3. The processing of structuring and organizing data is referred to as (a) Data Structure
(b) Data Organization (c) Data Manipulation (d) Data Modeling
4. The major concept for data modeling is to (a) Translate simple system design to complex
representation of data (b) Translate complex system design to simple representation of data (c)
Translate simple system design to simple representation of data (d) Translate complex system
design to complex representation of data
5. The term “Data Model” refers to two different things- data organization and ________ (a)
Data Model (b) Data Processing (c) Data Structure (d) Data Organization
6. The following are unstructured data Except (a) Video (b) email message (c) Picture (d) Database
7. Define data modeling.
8. List three (3) approaches to Data modeling.
9. State the major concept of Data Modeling.
SUBJECT: DATA PROCESSING
WEEK TWO
DURATION: 45 MINUTES
TOPIC: DATA MODELING 2 (Practical)
INSTRUCTIONAL MATERIALS: CLASSIC COMPUTER STUDIES BOOK 1, TUTORIAL VIDEOS &
PICTURE MATERIALS
OBJECTIVES: at the end of the lesson, learners should be able to:
1. Create tables
2. Create forms
3. Create queries
4. Create reports
CONTENT
Creating Tables
Creating Forms
Forms allows you to enter, edit or display data. They are based on tables. With forms, you can
choose the format and arrangement the fields will take or will be displayed.
To create a form
Click the table or query on which you want to base your form
After you create a form, you can save it. You can also open a saved form at any time.
Click OK. You can access the form by clicking the navigation pane.
Form Wizard
You can create forms with the help of a form wizard. On the create tab, click the more forms
down arrow.
Choose the Table/ Queries that you wish to have on the form
Click Next
Click Next
Choose Style
Click next
Choose whether you want to open the form to view it or modify the form’s design
Click finish
Creating Queries
A query allows you to select and filter data from multiple tables. Queries can be saved and
utilized as often as you need them.
The Query Wizard walks you through the steps to set up a query. To run a query using the
query wizard
Click OK
Click OK
Click Finish
Creating Report
Reports organize and summarize data for viewing online or for printing. A detail report displays
all of the selected records. Reports are a means to view and analyse large amount of data. You
can use the report wizard or create a custom report that meets your specific need.
From the field list, click and drag the fields to the report
Click Next
Click Next
Choose a style
Click Next
Create a title
Choose whether you want to o[pen the form to view it or modify the form’s design
Click Finish
Class Task
1. What is a form?
2. How would you create a form?
3. State the operations that can be performed in a database.
4. List five (5) data-type.
Ticket-Out
1. Another name for field type is known as ______ (a) File type (b) Name type (c) Record
type (d) Data type
2. Another name for unique identifier is known as ___ (a) Key (b) Data (c) Field(d) Record
3. ____ is an attribute or field that can be used to identify a record in a database table or file.
(a) Data (b) Field (c) Key (d) Table
4. ____ is used to design a database in a computer. (a) Database package (b) Graphics package (c)
Spreadsheet package (d) Word Processing package
5. ____ model organizes data using two fundamental constructs, called records and sets. (a)
Hierarchical (b) Relational (c) Network (d) Optical
SUBJECT: DATA PROCESSING
WEEK THREE
DURATION: 45 MINUTES
TOPIC: DATA MODELING 3
INSTRUCTIONAL MATERIALS: CLASSIC COMPUTER STUDIES BOOK 1, TUTORIAL VIDEOS &
PICTURE MATERIALS
OBJECTIVES: at the end of the lesson, learners should be able to:
1. State the significance of data modeling
CONTENT
Data models are a great communication tool because it facilitates interaction and
communication between designers, programmers and end users.
A well-developed data model can foster improved understanding of the organization for which
the database design is developed.
Data model help in structuring and organizing data. These data structures are then typically
implemented in a database management system which is used mostly by organizations for
decision making.
Data modeling will impose (implicitly or explicitly) constraints or limitations on the data placed
within the structure.
A standard data model or industry standard data model (ISDM) is a model that is widely applied
in some industry, and shared amongst competitors to some degree. They are often defined by
standard bodies, database vendors or operating system vendors. The most effective standard
models have developed in the banking, insurance, pharmaceutical and automotive industries,
to reflect the stringent standards applied to customer information gathering, customer privacy,
consumer safety or just in time manufacturing.
They enable easier and faster information sharing because heterogeneous organizations have a
standard vocabulary and pre-negotiated semantics, format and quality standards for exchange
data.
1. ISO 10303: this is an ISO standard for the computer-interpretable representation and exchange
of product manufacturing information.
2. ISO 15926: is a standard for data integration, sharing, exchange, and hand-over between
computer systems.
3. IDEAS Group: is the International Defense Enterprise Architecture Simplification for exchange
Group. The deliverable of the project is a data exchange format for military enterprise
architectures.
Class Task
Ticket-Out
1. Use MS Access to create table, form, queries and report for all the classes in your school.
SUBJECT: DATA PROCESSING
WEEK FOUR
DURATION: 45 MINUTES
TOPIC: NORMAL FORMS
INSTRUCTIONAL MATERIALS: CLASSIC COMPUTER STUDIES BOOK 1, TUTORIAL VIDEOS &
PICTURE MATERIALS
OBJECTIVES: at the end of the lesson, learners should be able to:
1. Explain the term normal forms
CONTENT
Eliminating redundant data ( for example storing the same data in more than one table)
Ensuring data dependencies make sense (only storing related data in a table)
Normal Form
The normal form (NF) of relational database theory provide critical for determining a table’s
degree of vulnerability to logical inconsistencies and anomalies. The higher the normal form
applicable to a table, the less vulnerable it is. Each table has a “Highest Normal Form” (HNF): by
definition, a table always meets the requirements of its HNF and all normal forms lower than its
HNF; also by definition, a table fails to meet the requirement of any normal form higher than its
HNF.
Normal form theory deal with how to reduce the amount of redundancy of data within a given
table. Each normal form represents a level. To satisfy each the requirements for certain level,
the requirements for the previous level must be met. To reach the optimal normal form for the
tables within a database, the creator starts with a large list of all the data that is to be held in
the database, and then works through the normal forms until he can no longer break
the data down into smaller table.
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 exist only one value, not an array or list of values
i.e. in 1NF, the following rules are observed;
The second normal form (2NF) further addresses the concept of removing duplicate data. The
rule for the second normal form is;
1. Remove subsets of data that apply to multiple rows of a table and place them in separate table.
2. Create relationships between these new tables and their predecessors through the use of
foreign keys.
NOTE: The 2NF attempts to reduce the amount of redundant data in a table by extracting it,
placing it in new table(s) and creating relationships between those tables.
There are two basic requirements for a database to be in Third Normal Form:
1. The requirements of both 1NF and 2NF must have been met.
2. Remove columns that are not fully dependent upon the primary key.
The Fourth Normal Form (4NF) and Fifth Normal Form (5NF)
The fourth and the fifth normal form are beyond the scope of this syllabus.
Note: Both the fourth and the fifth normal form still follows the goal of normalization process,
which are;
Class Task
1. Define Normalization.
2. Explain Normal Form.
3. One of the goals of normalization process is ____ (a)Eliminate redundant data (b)
Ensure data independencies (c) Allow Update, insertion and deletion(d) Create tables
4. The primary purpose of normalization is to ____ (a) Eliminate redundant data (b)
Ensure data dependencies (c) Allow Update, insertion and deletion (d) Create tables
5. Differentiate between a common sense and systematic normalization
Ticket-Out
1. State the rules for carrying out first normal form (1NF).
2. State the rules for carrying out second normal form (2NF).
SUBJECT: DATA PROCESSING
WEEK FIVE
DURATION: 45 MINUTES
TOPIC: NORMAL FORMS 2
INSTRUCTIONAL MATERIALS: CLASSIC COMPUTER STUDIES BOOK 1, TUTORIAL VIDEOS &
PICTURE MATERIALS
OBJECTIVES: at the end of the lesson, learners should be able to:
1. Explain the determination of normal forms
CONTENT
1. The minimal number of attributes necessary to support the data requirements of the enterprise
2. Attributes with a close logical relationship are found in the same relation.
3. Minimal redundancy with each attribute represented only once with the important exception of
attributes that form all or part of foreign keys
KEY: A key is an attribute or field that can be used to identify a record in a database table or file.
The primary Key is a unique attribute that can be used to identify a record in a database table.
For Example, in the student database table above, the attribute that is unique to identify each
record is the Student-ID or Reg. No.
A foreign key is a field in a relational table that matches a candidate key of another table. A
foreign key (FK) is a column or combination of columns that is used to establish and enforce a
link between the data in two tables. You can create a foreign key by defining a FOREIGN KEY
constraint when you create or modify a table. The foreign key can be used to cross-reference
table. The foreign key identifies a column or set of columns in one (referencing or child) table
that refers to a column or set of column in another (referenced or parent) table. The columns in
the child table must reference the columns of the primary key or other super key in the parent
table.
Ticket-Out
CONTENT
Entities
Attributes of entities
ERM is graphically represented using an entity-relationship diagram (E-R Diagram).
E-R diagrams depict an attribute inside an ellipse and connect the ellipse with a line to the
associated entity type. The diagram below indicates some of the possible attributes in an E-R
diagram for the entity STUDENT.
Types of attributes
1. Simple or an atomic attribute, such as City or State, cannot be further divided into smaller
components.
2. Composite attribute can be divided into smaller subparts in which each subpart represents
an independent attribute. Name and Address are the only composite attributes in the diagram
above.
3. Single-valued attribute: most attributes have a single value. For example, a student has only
one date of birth and one identification number.
4. Multi-valued attribute: have more than one value for an entity instance. For example,
student attribute language above, which stores the name of languages a student can speak,
is a multi-valued attribute.
5. Stored attribute is an attribute whose value cannot be derived from the values of other
attributes.
6. Derived attribute: the value of a derived attribute can be determined by analyzing other
attributes. For example in the figure above, Age is a derived attribute because its value can be
derived from the current date and the attribute DateofBirth.
7. A key attribute (or identifier) is a single attribute or a combination of attributes that uniquely
identify an individual instance of an entity type. No two instances within an entity set can have
the same key attribute value. StudentID is the key attribute in the picture above.
Relationship
Entities in an organization do not exist in isolation but are related to each other. Students take
courses and each STUDENT entity is related to the COURSE entity. Faculty members teach
courses and each FACULTY entity is also related to the COURSE entity. Consequently, the
STUDENT entity is related to the FACULTY entity through the COURSE entity. In an E-R diagram,
we represent relationship types with diamond-shaped boxes connected by straight lines to the
rectangles that represent participating entity types. A relationship type is a given name that is
displayed in this diamond-shaped box and typically takes the form of a present tense verb or
verb phrase that describes the relationship. A relationship is an association among several
entities. The figure below is an E-R diagram that shows a relationship between entities
ACCOUNT and CUSTOMER.
Degree of a relationship
The number of entity sets that participate in a relationship is called the degree of relationship.
The 3 most common degrees of relationship are unary (degree 1), binary (degree 2) and ternary
(degree 3).
Unary relationship: A unary relationship exists when there is an association between two
instances of the same entity type. For example, in an organization, an employee will manage
one or more employee.
Binary relationship: A binary relationship exists when there is an association between two
instances of two different entity types. For example, in a secondary school, a binary relationship
exists between a Subject (SUBJECT entity) and a Teacher (TEACHER entity); a teacher teaches
(a) subject.
Ternary Relationship: A ternary relationship exists when there is an association between three
instances of three different entity types. For example, consider a student using certain
equipment for a project. In this case, the STUDENT, PROJECT, and EQUIPMENT entity types
relate to each other with ternary relationships: a student checks out equipment for a project.
Cardinality of a relationship
The cardinality is the number of occurrences in one entity which are associated (or linked) to
the number of occurrences in another entity. For example, if the entity types A and B are
connected by a relationship, then the maximum cardinality represents the maximum number
of instances of entity B that can be associated with any instance of entity A. There are three
types of relationship:
1. One-to-One Relationship: In a one-to-one relationship, at most one instance of entity B can
be associated with a given instance of entity A and vice versa. For example an employee is
assigned a parking space or an employee manages the department.
1. The Entity-Relationship Diagram is used to identify the data that must be captured, stored and
retrieved in order to support the business.
2. The Entity-Relationship Diagram is also used to identify the data required to derive and
generate report on the performance measures that an organization should be monitoring.
Class Task
1. ____ is the unique, distinguishing characteristic of the entity. (a) Entity (b) Relationship (c)
Attribute (d) cardinality
2. Another name for data Element is ____. (a) Attribute (b) Key (c) Entity (d) Relationship
3. ____ are objects or concepts within the data model. (a) Attributes (b) Relationship (c)
Cardinality (d) Entity
4. A roof covering a building will be considered in relationship as? (a) One-to-Many (b) Many-to-
Many (c) One-to-One (d) Many-to-One
5. A pastor preaching to his congregation will be considered in relationship as? (a) One-to-Many
(b) Many-to-Many (c) One-to-One (d) Many-to-One
SUBJECT: DATA PROCESSING
WEEK EIGHT, NINE & TEN
DURATION: 45 MINUTES
TOPIC: RELATIONAL MODEL (Practical)
INSTRUCTIONAL MATERIALS: CLASSIC COMPUTER STUDIES BOOK 1, TUTORIAL VIDEOS &
PICTURE MATERIALS
OBJECTIVES: at the end of the lesson, learners should be able to:
1. Explain how data is represented.
CONTENT
Relational Models
Relational Database Management System (RDBSM) is the basis for SQL (Structured Query
Language), and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL
and Microsoft Access.
A relational model gives a simple way of representing data in form of a two-dimensional table
called relation. Relational model was invented by Edger Codd. The columns or fields in the
table identify the attribute such as surname, last name, age, gender, Admission number etc. A
tuple or row contains all the data of a single instance of the table such as a person named
James Bond. In the relational model, every tuple must have a unique identification or key based
on the data. In the table below, the Admission number is the key that uniquely identifies each
tuple in the relation. Keys are often used to join data from two or more relations based on
matching identification. Another concept used in a relational model is the foreign keys, which
are primary keys in one relation that are kept in another relation to allow for the joining of
data.
Definition of terms
1. Field: is a named column in the relation (table). There are five fields in the student relation
above – Admission number, Surname, Last name, Age, Gender.
2. Tuple: is a record (i.e. a row of data in a relation). All tuples in a relation must be distinct.
3. Domain: is defined as the set of all unique values permitted for an attribute. For example, the
domain of the field Gender as seen in the table above is M and F. Also the domain of the
attribute Surname consist the combination of all possible letters in the alphabet. A domain is
referred to in a relation schema by the domain name and has a set of values.
4. The Degree (also called arity) of a relation is the number of fields in it. The relation above is of
degree 5.
5. The cardinality of a relation is the number of tuples in it. For example, the relation above
contains 6 tuples and hence the cardinality is 6.
6. A relational database is a collection of relations with distinct names that can be linked
together.
7. Relation schema describes the column heads of the table. The schema specifies the relation’s
name, the name of the field (or attribute or column) and the domain of each field. For example
the schema for the Student relation above is given below:
Student(Admission number: integer, Surname: string, last
name: string, Age: integer, Gender: string).
DDL – Data Definition Language: CREATE (forms a new table, a view of a table, or other object
in database. ALTER (modifies an existing database object, such as a table). DROP (deletes an
entire table, a view of a table or other object in the database).
DML – Data Manipulation Language: INSERT (creates records). UPDATE (modifies records).
DELETE (deletes records).
DCL – Data Control Language: GRANT (gives a privilege to a user). REVOKE (takes back privileges
granted to users).
DQL – Data Query Language: SELECT (retrieves certain records from one or more tables)
Querying Database
You query the database when you are requesting for certain information from the database.
You can include condition that such items you want should meet. The query helps us retrieve
data from the database.
In its simplest form, a query consists of two parts:
· A SELECT list, where the columns to be retrieved are specified
· A FROM clause, where the table or tables to be accessed are specified
Example
The following SQL statement selects the entire rows of data from the StudentTbl:
SELECT * FROM StudentTbl
It is also possible to specify certain columns to be retrieved from the StudentTbl.
Example
SELECT FirsName, LastName, Age FROM StudentTbl
We can structure the query to limit the number of columns of data to be retrieved from the
StudentTable.
Example
SELECT FirstName, LastName, Date
FROM StudentTbl
WHERE Age > 20
Integrity Constraint over Relations
Constraints
Constraints are the rules enforced on data columns in table. These are used to limit the type of
data that can go into a table. This ensures the accuracy and reliability of the data in the
database. Constraints could be column level or table level. Column level constraints are applied
only to one column, whereas table level constraints are applied to the whole table. The
following are commonly used constraints in SQL:
1. Entity Constraints
Entity constraints can be enforced when you create a table and assign certain column of the
table to be the primary key or and when you assign certain column of that table not to accept
NULL values. The PRIMARY key constraint tells the database engine that none of the rows
should have a duplicate value. The NOT NULL constraint ensures that a column cannot have a
NULL value
Examples
CREATE TABLE StudentTbl (
StudentId INT Primary Key,
FirstName Varchar(15) NOT NULL,
LasttName Varchar(15) NOT NULL,
Gender Char(2),
DOB DateTime
);
You can also use the UNIQUES constraint to ensure that all values in a column are different;
that is, no duplicate entries should exist in the table.
CREATE Table StudentData (
StudentId INT Primary Key,
FullName Varchar(50) unique NOT NULL,
Age INT,
RegDate DateTime Default GETDATE()
);
The GetDate function inserts the current date into the table.
2. Domain Integrity
This constraint can be enforced by specifying that certain columns in the table should be of a
particular data type or that it should meet certain conditions. Example below employs two
types of constraints: CHECK and UNIQUE constraints. The CHECK constraint ensures that all
values in a column satisfy certain conditions (i.e. any record to be inserted must have age value
greater than or equal to 10).
Example
CREATE Table StudentData (
StudentId INT Primary Key,
FullName Varchar(50) unique NOT NULL,
Age INT Check(Age > = 10),
RegDate DateTime Default GETDATE()
);
The DEFAULT constraint provides a default value for the date column when no value is
specified.
3. Referential Integrity
Referential Integrity constraint can be enforced using two or more tables. The first table is
called the parent table while any other table or tables will be regarded as the child table(s). The
child table(s) will be used to reference the parent table.
Example
Create the first table called the parent table:
CREATE TABLE Student(
StudentId INT Primary Key,
FirstName Varchar(15) NOT NULL,
LasttName Varchar(15) NOT NULL,
Gender Char(6),
DOB DateTime
);
Create the second table called the child table:
CREATE TABLE Subject(
SubjectId INT Primary Key,
StudentId INT Foreign Key References Student_tbl(StudentId),
SubjectName varchar(15) Unique,
TeacherName varchar(50) Not Null,
Duration DateTime
);
StudentId in the Subject table is a foreign key that “references” StudentId in the Student table
called the parent table. The idea behind this is that a subject cannot exist for a student when
that student is not in the student (parent) table. For example, in order for a student to have a
subject in the Subject table, such student must exist in the Student table.
SUBJECT: DATA PROCESSING
WEEK ELEVEN
DURATION: 45 MINUTES
TOPIC: FILE ORGANIZATION
INSTRUCTIONAL MATERIALS: CLASSIC COMPUTER STUDIES BOOK 1, TUTORIAL VIDEOS &
PICTURE MATERIALS
OBJECTIVES: at the end of the lesson, learners should be able to:
1. Explain the various types of file organization
CONTENT
A fie is a collection of data usually stored on disk. File organization refers to the logical
relationships among various records that constitute the file, particularly with respect to the
means of identification and access to any specific record.
File organization is used to describe the way in which the records are stored in terms of blocks,
and the blocks are placed on the storage medium. In short, it refers to the way in which data
records are stored or arranged.
File access
When a file is used, information is read and accessed into computer memory and there are
several ways to access this information of the file. The file accessing methods are:
1. Direct access: the information/data stored on a device can be accessed randomly and
immediately irrespective to the order it was stored. The data with this access method is quicker
than sequential access. This is also known as random access method. For example hard disk,
flash drive etc.
2. Sequential access: the information/data stored on a device is accessed in the exact order in
which it was stored i.e. one record after another e.g. magnetic tape.
2. File activity
Class Task
1. What is file organization?
2. Explain the types of file organization we have
3. What are the factors to consider when choosing a file organization method?
Ticket-Out
1. Go to YouTube and search for videos on file organization methods. Copy out the URL and your
summary of the video.