E-Note SS Two 1st Term Data Processing
E-Note SS Two 1st Term Data Processing
Reference Book
A textbook of Data Processing for SSS 2 by Adedapo F O and Mitchell A. S
WEEK ONE
TOPIC: DATA MODELS
CONTENT:
1. Definition of Data Model
2. Concept of Data Modelling
3. Type of data model
4. Levels of Data Model (Approach)
A data model is an abstract model that organizes elements of data and standardizes how
they relate to one another and to properties of the real-world entities. For instance, a data
model may specify that the data element representing a car be composed of a number of
other elements which, in turn, represent the color and size of the car and define its owner.
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 organize data using a database
management system.
Database Model:
A database model is a specification describing how a database is structured and used.
FHNROS
Types of Database Model
i. Flat model: The flat model is the earliest, simplest data model. It simply lists all the data
in a single table, consisting of columns and rows. In order to access or manipulate the
data, the computer has to read the entire flat files into memory, which makes this model
inefficient for all but the smallest data sets.
ii. Hierarchical model: The hierarchical model organizes data into a tree-like structure,
where each record has a single parent or root. Sibling records are sorted in a particular
order. That order is used as the physical order for storing the database. This model is
good for describing many real-world relationships.
iii. Network model: This model organizes data using two fundamental constructs, called
records and sets. Records contain fields, and sets define one-to-many relationships
between records: one owner, many members. The network data model is an abstraction
of the design concept used in the implementation of databases.
iv. Relational model: The most common model, the relational model sorts data into tables,
also known as relations, each of which consists of columns and rows. Each column lists
an attribute of the entity in question, such as price, zip code, or birth date. Together, the
attributes in a relation are called a domain.
v. Object-relational model: This hybrid database model combines the simplicity of the
relational model with some of the advance functionality of the object-oriented database
model. In essence, it allows designers to incorporate objects into the similar table
structure.
vi. Star Schema: A star schema is a multi-dimensional data model used to organize data in a
database so that it is easy to understand and analyze. Star schemas can be applied to da
warehouses, databases, data marts and other tools. The star schema design is optimized
for query large data sets.
Entity-relationship model
An entity-relationship model (ERM), sometimes referred to as an entity-relationship diagram
(ERD), is an abstract conceptual data model (or semantic data model) used in software
engineering to represent structured data. It depicts relation among people, objects, places,
concepts or events within an Information Technology (IT) system. There are several
notations used for ERMs
Logical Data Model: is the translation of the conceptual model into structure that can be
implemented using a database management system (DBMS).
This model specifies tables and columns. These are the basic building blocks of relational
databases, which are implemented using a relational database management system
(RDBMS)
Physical Data Model: this incorporates any changes necessary to achieve adequate
performance and is also presented in terms of tables and columns, together with a
specification of physical storage and access mechanisms.
EVALUATION:
i. What is conceptual data model?
ii. What does data model focus on?
iii. What is logical data model?
iv. Discuss the different approach to data model
v. State the concept of data modelling.
vi. Describe the following: Data Structure and Data Organization.
READING ASSIGNMENT:
Study the topic ‘Data modelling” using students’ textbook
WEEKEND ASSIGNMENT:
OBJECTIVE TEST:
1. In a database data is organized into simple (a) tables (b) rows (c) columns (d) type
2. A data model is a ___ representation of the data structure that are required by a
database. (a) logical (b) conceptual (c) physical (d) dynamic
3. The following is not a step of design process: (a) planning (b) logical design (c) survey
(d) implementation
4. The term “Data Model” refers to two different things, data organization and
____________ (a) data model (b) data processing (c) data structure (d) data organization
5. The process of structuring and organizing data is referred to as __________ (a) data
structure (b) data organization (c) data manipulation (d) data modelling
WEEK TWO
CONTENT:
1. Organization of Database using MS Access
2. Creating Database, Files (Tables), Fields with Datatypes
Data modeling is a method used to define and analyze data requirements needed to support
the business processes of an organization. The data requirements are recorded as a
conceptual data model with associated data definitions. Actual implementation of the
conceptual model is called a logical data model.
Creating Database
1. From the displayed window, click on blank database
2. By the right-hand side of the windows, where the arrow is pointing in the picture-screen
above, click inside the file name text box and type the desired database name.
3. Click on create command button. A database with the filename given will be created.
Generally, creating a database using any DBMS entails the following basic steps:
Define the database structure
Specify field type
Input Data
Input Data
After the field names and their data types have been specified, then records are stored in
the database by specifying the appropriate input. In MS Access, to input a data;
Double click on the Student Tale at the left-hand pane of MS Access windows
Enter the data beneath the field names and click on the next cell to populate data.
To keep database updated, data inputted into the database must be saved regularly.
Keyboard command CTRL+S is used. Alternatively, you click on the office button and save.
Creating a file
Files are created as tables in the database.
1. Click on create menu and select table
2. At all tables tab, right click on any of the table
3. Select design view
In the save as dialog box, type a desired table name (e.g. Student Table) in the Table name
text box and click ok.
Tables in database on a computer are composed of rows and columns. A table in MS Access
is organized into rows and columns like the picture screen shown below.
Creating Fields with Data Types
Fields are assigned field names relevant to the information they keep. Field names are
assigned data types which determine the kind of data they accept as input. For example, in
MS Access Table above, Surname are alphabetic, the fields will not accept numeric
(numbers) inputs 10 or 500 as surname. To set data type for filed in MS Access, follow the
step below:
After creating the table in design view under the field name tab, then type the field name
and under the data type table next to the field name, click the drop down menu and
select AutoNumber as shown below
For example, using the above picture screen, the field name ID number will be assigned
Number data type since the ID numbers will be numeric. In the same way, TEXT data type
will be assigned to Surname, Firstname and Othername.
Unique Identifier
A table contains a unique identifier i.e. a KEY. In MS Access, a default primary key is usually
specified for the first field. To set another field of your choice as primary key, right click on
the first cell and select Primary key.
To delete a Table
1. Open the desired database by clicking the Microsoft office button and clicking open
2. Right click on a table and choose delete
To rename a Table
1. Open the desired database by clicking the Microsoft office button and clicking open.
2. Right click on a table and choose Delete.
3. Type in the new name.
EVALUATION:
1. How is database created?
2. What are the basic steps that entails creating a database?
3. What are the datatypes you can specify in MS-Access?
4. How do you create fields with datatypes?
GENERAL EVALUATION
1. Write down steps on how to perform the following on MS Access
- To edit data-type
- Delete a table
- Rename a table
2. Write down steps on how to load MS Access
WEEKEND ASSIGNMENT
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
WEEK THREE
CONTENT:
1. Creating Forms, Queries and Reports
2. Significance of Data Model
3. Standard Data Model
To create a form:
1. Open the navigation pane
2. Click the table or query on which you want to base your form
3. Activate the create tab
4. Click form in the forms group
After you create a form, you can save it. You can also open a saved form at any time.
5. Click the save button on the quick access toolbar
6. Type the name you want to give the form
7. 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 table, click the more
forms down.
1. Click Form Wizard
2. Choose the Table/Queries that you wish to have on the form
3. Choose the field you wish to have on the forms
4. Click Next
5. Choose the layout for the form
6. Click Next
7. Choose style
8. Click Next
9. Create a title for the form
10. Choose whether you want to open the form to view it or modify the form’s design
11. Click finish
Creating Query
The Query wizard walks you through the steps to set up a query. To run a query using the
query wizard
1. Click the create tab
2. Click the query wizard button under group
3. Choose the type of query you wish to urn
4. Click OK
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 analyze large amount of
data. You can use the report wizard or create a custom report that meets your specific need.
1. Click the Blank report button on the Create Tab
2. Click the Add Existing fields button
3. From the field list, click and drag the fields to the report
When in use, they enable easier and faster information sharing due to the fact that
heterogeneous organization have a standard vocabulary and pre-negotiated semantics,
format, and quality standards for exchange data. The standardization has an impact on
software architecture as solutions that vary from the standard may cause data sharing issues
and problems if data is out of compliance with the standard.
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.
The most complex data models known are in military use, and consortia such as NATO tend
to require strict standards of their members’ equipment and supply database. However,
they typically do not share these with non-NATO competitors, and so calling these ‘standard’
in the same sense as commercial software is probably not very appropriate.
EVALUATION:
1. What is a form?
2. How would you create a form?
3. What are the examples of standard data model?
4. Explain standard data model.
5. What is the significance of data modeling?
6. What is another name for “standard data model”?
7. State two examples of standard data model
READING ASSIGNMENT:
Study the topic ‘Data modelling” using students’ textbook
WEEKEND ASSIGNMENT:
OBJECTIVE TEST:
1. In a database data is organized into simple (a) tables (b) rows (c) columns (d) type
2. A data model is a ___ representation of the data structure that are required by a
database except. (a) logical (b) conceptual (c) physical (d) dynamic
3. The following is not a step of design process: (a) planning (b) logical design (c) survey
(d) implementation
4. Creating a Query, choose the following from New Query dialog box. (a) creating query
wizard (b) design view (c) simple query wizard (d) none of the above
5. Standard Data Model can also be called ________ (a) Manufacture Standard Data Model
(b) Industry Standard Data Model (c) Structured Standard Data Model (d) Enhanced
Standard Data Model
6. ______ are great communication tool because it allows interaction and communication
between designers, programmers and end users. (a) Data model (b) Normal form (c)
Database (d) Attribute
7. What is the full meaning of ISDM? (a) Industry significant data model (b) International
standard data model (c) International significant data model (d) industry standard data
model
8. _________ is the international defense enterprise architecture specification for exchange
group. (a) Ideas Group (b) Standard Group (c) Best Group (d) Normal Group
WEEK FOUR: First Continuous Assessment (1st CA)
WEEK FIVE:
TOPIC: NORMAL FORMS I
CONTENT:
1. Concept of Normalization
2. Definition of Normal Form
3. Normalization Rules (Types of Normal Forms)
In First Normal Form, any row must not have a column in which more than one value is
saved, like separated with commas. Rather than that, we must separate such data into
multiple rows.
The 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.
In example of First Normal Form there are two rows for Adam, to include multiple subjects
that he has opted for. While this is searchable, and follows First normal form, it is an
inefficient use of space. Also in the above Table in First Normal Form, while the candidate
key is {Student, Subject}, Age of Student only depends on Student column, which is incorrect
as per Second Normal Form. To achieve second normal form, it would be helpful to split out
the subjects into an independent table, and match them up using the student names as
foreign keys.
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.
For example, consider a table with following fields.
Student_DetailTable :
Student_id Student_name DOB Street city State Zip
In this table Student_id is Primary key, but street, city and state depends upon Zip. The
dependency between zip and other fields is called transitive dependency. Hence to apply
3NF, we need to move the street, city and state to new table, with Zip as primary key.
New Student_DetailTable :
Student_id Student_name DOB Zip
Address Table :
Zip Street city state
The advantage of removing transitive dependency is,
Amount of data duplication is reduced.
Data integrity achieved.
N/B: The Fourth and the Fifth normal form are beyond the scope of this scheme.
EVALUATION:
1. What is normalization?
2. Explain normal form
3. State the two goals of normalization process
4. What is 1NF?
5. State the rules for carrying out 1NF, 2NF and 3NF
READING ASSIGNMENT:
Study the topic ‘Normal Forms” using students’ textbook
WEEKEND ASSIGNMENT:
OBJECTIVE TEST:
1. __________ normal form says that all columns values must be atomic. (a) 1NF (b) 2NF (c)
3NF (d) 4NF
2. _________ normal form must meet the requirement of first and second. (a) 1NF (b) 2NF
(c) 3NF (d) 4NF
3. One of the following is a basic requirement for database to be in the third normal form
(a) remove columns that are not fully dependent upon the primary key (b) Create
relationship between the new tables (c) Eliminate repeating information (d) remove
subsets of data that apply to multiple rows
4. How many value(s) exist in 1NF for every row-by-column position in a given table? (a)
one (b) two (c) three (d) four
5. A table always meets the requirement of its ____ form.
6. The normal forms are applicable to individual ______
WEEK SIX:
TOPIC: NORMAL FORMS II
CONTENT:
1. Problems of Table in First Normal Form
2. Determinant of Normal Forms
3. Keys
From the table above, the basic problem is that department names and addresses are really
data about departments rather than employees, and belong to a separate Department
table. We therefore establish a third table for department data, resulting in the three-table
model below:
Employee table
Employee Number Employee Name Department Number
01287 Clark 05
22617 Walsh 05
70964 Smith 12
50607 Black 05
Department Table
Dept. Number Dept Name Dept. Location
05 Auditing HQ
12 Legal MS
Qualification Table
Employee Number Qualification Description Qualification year
01287 Bachelor of Art 1970
22617 Master of Art 1973
70964 Doctor of Philosopy 1976
50607 Bachelor of Art 1969
Formally, we say Hospital Number is a determinant of the other four columns. We can show
this as:
Hospital Number Hospital Name, Contact Person, Hospital Type, Teaching Status
Where we read “ “ as “determines” or “is a determinant of”.
Determinants need not consist of only one column; they can be a combination of two or
more columns, in which case we can use a + sign to indicate such a combination.
E.g. Hospital Number + Operation Number Surgeon Number.
This leads us to a more formal description of the procedure:
1. Identify any determinants, other than the primary key, and the columns they
determine.
2. Establish a separate table for each determinant and the columns it determines. The
determinant becomes the key of the new table.
3. Name the new tables.
4. Remove the determined columns from the original table. Leave the determinants to
provide links between tables.
Sub-topic 3: Keys
A key is an attribute or field that can be used to identify a record in a database table or file.
Primary Keys
The primary key is a unique attribute that can be used to identify a record in a database
table. It is a nominated column or combination of columns that has a different value for
every row in the table. Each table has one (and only one) primary key. When checking this
with a business person, we would say, “if I nominated, say, a particular account number,
would you be able to guarantee that there was never more than one account with that
number?”
For example, in the student database table, the attribute that is unique to identify each
record is the Student-ID or RegNo.
Candidate Keys
Sometimes more than one column or combination of columns could serve as a primary key.
E.g, we could have chosen Drug Name rather than Drug Short Name as the primary key of
the Drug table (assuming, of course, that no two drugs could have the same name). we refer
to such possible primary keys, whether chosen or not, as candidate keys. From the point of
view of normalization, the important thing is that candidate keys that have not been chosen
as the primary key, such as Drug Name, will be determinants of every column in the table,
just as the primary key is.
Foreign Keys
Recall that when we removed repeating groups to a new table, we carried the primary key of
the original table with us, to cross-reference or “point back” to the source. In moving from
first to third normal form, we left determinants behind as cross-reference to the relevant
rows in the new tables.
These cross-referencing columns are called foreign keys, and they are our principal means of
linking data from different tables.
The 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
EVALUATION:
i. What is primary key?
ii. What is the use of foreign keys?
iii. What are candidate keys?
READING ASSIGNMENT:
Study the topic ‘Entity Relational Model” using students’ textbook
WEEKEND ASSIGNMENT:
OBJECTIVE TEST:
1. Foreign key is a field in a relational table that matches a ___ of another table.
(a) candidate key (b) row (c) field (d) none of the above
2. Each value of the primary key uniquely identifies one ___ of the table. (a) column
(b) row (c) field (d) none of the above
WEEK SEVEN: Midterm Break
WEEK EIGHT:
TOPIC: ENTITY RELATIONSHIP MODEL
CONTENT:
1. Entities, attributes and relationship
2. Additional features of entity model
PRODUCT Entity
ProductID
Unit price
Attributes
Name
SUPPLIER
Relationship
Address
The rectangle in the diagram above are called entity type and the ovals are called attributes.
The entities are the ‘things’ in business environment about which we want to store data. The
attributes provide us with a means of organizing and structuring the data.
Entities
Entities are drawn as rectangular boxes containing a noun in singular form.
You will see later that each entity you draw ultimately becomes a table in your database.
You might want to keep this transformation from entity to table in mind when selecting the
names of your entities. E.g. your entity names should be short but descriptive.
Customer
Relationship
A relationship between entities is drawn as a line bisected by a
diamond. The diamond contains a verb (or short verb phrase) that
buys
describes the nature of the relationship between the entities.
Named relationship are used to make the ERDs more readable. However, unlike entity
names, relationship names never show up in the final database.
Attributes
Attributes are properties or characteristics of a particular entity about which we wish to
collect and store data. In addition, there is typically one attribute that uniquely identifies
particular instances of the entity. E.g. each of your customers may have a unique customer
ID. Such attributes are known as Key attributes.
Name
Phone No
CustID
Name
Phone No
CustID
Contact person
Sale Product
EVALUATION:
i. What are entities?
ii. What are attributes?
iii. What are associative entities?
READING ASSIGNMENT:
Study the topic ‘Relational Model” using students’ textbook
WEEKEND ASSIGNMENT:
OBJECTIVE TEST:
1. The ___ provide us with a means of organizing and structuring the data.
2. A set of tools and procedures for applying the tools that specifies the notation used
within the organization is called ______
3. To transform a relationship into an entity on an ERD, we use a special symbol called
an (a) Entity (b) Attribute (c) associative entity (d) none of the above
WEEK NINE: SECOND CONTINUOUS ASSESSMENT (2ND CA)
WEEK TEN:
TOPIC: RELATIONAL MODEL I
CONTENT:
1. Creating and modifying relations using SQL
2. Integrity constraints over relations
Activity Activity
Code code
23 Patching
24 Overlay
Activity Date
25 Crack Code Route No
24 01/12/01 1-95
Sealing
24 02/08/01 1-66
Date Activity
Code Route No
01/12/01 24 1-95
01/15/01 23 1-495
02/08/01 24 1-66
The purpose of the relational model is to provide a declarative method for specifying data
and queries.
A relation is a table structure definition (set of column definitions) along with the data
appearing in that structure. The structure definition is the heading and the data appearing in
it is the body, a set of rows. A database relvar (relation variable) is commonly known as base
table. Operators called the Update operators are used to interact with the database.
Example, INSERT, UPDATE or DELETE.
SQL
SQL (often referred to as structured query language) is a programming language designed for
managing data in relational database management system(RDBMS). It is use for data insert,
query, update and delete, schema creation and modification, and data access control. SQL
can achieve the following in a database:
a. SQL can execute queries against a database
b. SQL can retrieve data from a database
c. SQL can insert records into a database
d. SQL can update records in a database
e. SQL can delete records from a database
f. SQL can create new databases
g. SQL can create new tables in a database
h. SQL can create store procedures in a database
i. SQL can create views in a database
j. SQL can set permissions on tables, procedures and views.
DDL part of SQL permits creating and deleting of Databases and database tables.
KEYWORDS USE
CREATE DATABASE Creates a new database
ALTER DATABASE Modifies a database
CREATE TABLE Creates a new table
ALTER TABLE Modifies a table
DROP DATABASE Deletes a database
DROP TABLE Deletes a table
CREATE INDEX Creates an index (search key) it is always an integer
DROP INDEX Deletes an index
ADD Add a column or a constraint to a table
The empty table can now be filled with INSERT INTO statement.
MODIFY A TABLE
To modify a table, you use an ALTER TABLE command. You can use an ALTER TABLE
command to add, modify, or drop (remove) columns or constraints. An ALTER TABLE
command has the following syntax:
ALTER TABLE table_name predicate
where predicate can be any one of the following:
ADD COLUMN field type[(size)] [NOT NULL] [CONSTRAINT constraint]
ADD CONSTRAINT multifield_constraint
ALTER COLUMN field type[(size)]
DROP COLUMN field
DROP CONSTRAINT constraint
Suppose that you want to add a 10-character text field to store information about the grades
of each student. You can do the following:
1. On the Create tab, in the Macros & Code group, click Query Design.
2. Close the Show Table dialog box.
3. On the Design tab, in the Query Type group, click Data Definition.
The design grid is hidden, and the SQL view object tab is displayed.
4. Type the following SQL statement:
ALTER TABLE student ADD COLUMN grades TEXT(10)
5. On the Design tab, in the Results group, click Run.
Single-field constraints
A single-field CONSTRAINT clause immediately follows the definition of the field that it
constrains, and has the following syntax:
CONSTRAINT constraint_name {PRIMARY KEY | UNIQUE | NOT NULL |
REFERENCES foreign_table [(foreign_field)]
[ON UPDATE {CASCADE | SET NULL}]
[ON DELETE {CASCADE | SET NULL}]}
Multiple-field constraints
A multiple-field CONSTRAINT clause can be used only outside a field-definition clause, and
has the following syntax:
CONSTRAINT constraint_name
{PRIMARY KEY (pk_field1[, pk_field2[, ...]]) |
UNIQUE (unique1[, unique2[, ...]]) |
NOT NULL (notnull1[, notnull2[, ...]]) |
FOREIGN KEY [NO INDEX] (ref_field1[, ref_field2[, ...]])
REFERENCES foreign_table
[(fk_field1[, fk_field2[, ...]])] |
[ON UPDATE {CASCADE | SET NULL}]
[ON DELETE {CASCADE | SET NULL}]}
EVALUATION:
i. What is a constraint?
ii. What is Data manipulation Language(DML)?
iii. Data Definition Language(DDL)?
READING ASSIGNMENT:
Study the topic ‘Integrity constraint” using students’ textbook