You are on page 1of 17

Teache Mr. Njoku Callistus O.

Subject: Data Class: Grade Age: 14+


r Processing 11

Week Week One Ending 23rd Time: 1:45-2:30 PM Class Size: Sex: Mixed
Sept., 2022 15
Date Duration: 45
19th September 2022 Minutes
Topic Types of data models
Objective By the end of the lesson, the learners should be able to;
s 1. Explain the term data model
2. State the types of data models
3. Appreciate the need for data models
4. Enumerate the levels of data modeling
5. Understand the various approaches to data modelling
Correctly and satisfactorily using the instructional resources provided as guide.
Instructio Charts, Microsoft Access package
nal
Resource
s
Instructio Discussions and Discovery, Questioning, Demonstration, Visual imagery
nal
Techniqu
es
Entry The facilitator introduces the lesson by reviewing the learner’s knowledge on the last
Behaviou lesson. The learners have learned concepts of data bases in tenth grade.
r
Instructio Step 1: Introduction
nal A data model is the organization of data elements and the standard on how the data
Procedur elements relate to one another
e
A data element is any unit of data defined for processing; for example, ACCOUNT
Step 1 NUMBER, NAME, ADDRESS and CITY. A data element is defined by size (in
characters) and type (alphanumeric, numeric only, true/false, date, etc.). A specific
set of values or range of values may also be part of the definition.
This is to say a data element is defined by the data type

ACTIVITY 1
Write five data types of elements contained in a data model

Data Properties
Some important properties of data for which requirements need to be met are
1. Relevance: The usefulness of the data in your business
2. Clarity: The availability of a clear and shared definition for data
3. Consistency: The compatibility of the same type of data from different
sources
4. Timeliness: The availability of data at the time required and how up to date
that data is
5. Accuracy: How close to the truth the data is
6. Completeness: How much of the required data is available
Step 2 7. Accessibility: Where, how and to whom the data is available (security)
8. Cost: The cost incurred in obtaining the data and making it available for use
Types of data models
1. Flat model: It is a simple model in which the database is represented as a
table consisting of rows and columns. To access any data, the computer has
to read the entire table. This makes the modes slow and inefficient
2. Hierarchical model: This model organizes the data in a tree structure. The
hierarchy starts from the root which has root data and then it expands in the
form of a tree adding child node to the parent node. This model easily
represents some of the real-world relationships like sitemap of a website.
Example: We can represent the the site map of a website in the following
way

3. Network Model: This model is an extension of the hierarchical model. It


was the most popular model before the relational model. This model is the
same as the hierarchical model, the only difference is that a record can have
more than one parent. It replaces the hierarchical tree with a graph.
Example: In the example below we can see that node student has two
parents i.e. CSE Department and Library. This was earlier not possible in the
hierarchical model.
4. Relational Model: Relational Model is the most widely used model. In this
model, the data is maintained in the form of a two-dimensional table. All the
information is stored in the form of row and columns. The basic structure of
a relational model is tables. So, the tables are also called relations in the
relational model

5. Entity-Relationship model: Entity-Relationship Model or simply ER


Model is a high-level data model diagram. In this model, we represent the
real-world problem in the pictorial form to make it easy for the stakeholders
to understand. It is also very easy for the developers to understand the system
by just looking at the ER diagram. We use the ER diagram as a visual tool to
represent an ER Model. ER diagram has the following three components:
 Entities: Entity is a real-world thing. It can be a person, place, or even a
concept. Example: Teachers, Students, Course, Building, Department, etc
are some of the entities of a School Management System
 Attributes: An entity contains a real-world property called attribute.
This is the characteristics of that attribute. Example: The entity teacher
has the property like teacher id, salary, age, etc.
 Relationship: Relationship tells how two attributes are related. Example:
Teacher works for a department
Step 3

In the above diagram, the entities are Teacher and Department. The attributes
of Teacher entity are Teacher_Name, Teacher_id, Age, Salary,
Mobile_Number. The attributes of Department entity are Dept_id,
Dept_name. The two entities are connected using the relationship. Here, each
teacher works for a department.
6. Object-oreinted Data Model: The real-world problems are more closely
represented through the object-oriented data model. In this model, both the
data and relationship are present in a single structure known as an object. We
can store audio, video, images, etc in the database which was not possible in
the relational model (although you can store audio and video in relational
database, it is advised not to store in the relational database). In this model,
two or more objects are connected through links. We use this link to relate
one object to other objects. This can be understood by the example given
below.

In the above example, we have two objects Employee and Department. All
the data and relationships of each object are contained as a single unit. The
attributes like Name, Job_title of the employee and the methods which will
be performed by that object are stored as a single object. The two objects are
connected through a common attribute i.e the Department_id and the
communication between these two will be done with the help of this
common id

ACTIVITY 2: Discussion
Which of the models explained above would you prefer? Give reasons
Approaches to data modelling
There are three levels or approaches to data modelling. They include:
1. Conceptual data model: It identifies the high-level user view of data, and
establishes the entities and the relationship between them
2. Logical data model: this model is in between the conceptual and physical
data model. It describes the structure of the data elements and the
relationship between them. It describes the data in detail as much as possible
without regard to how they will be physically implemented in the database
3. Physical model: This is a schema or framework for how data is physically
stored in a database. It

Evaluatio 1. Define data model


n 2. State the types of data models
Summary A data model is the organization of data elements and the standard on how the data
elements relate to one another. Data has properties which help make it meaningful.
There are so many data models, 6 of which have been discussed in the lesson. The
data model to be used depends on the type of data. A data model clearly determines
the structure if the data

Assignme 1. Give five reasons for using a data model


nt 2. Explain the need for data models
Referenc 1. https://afteracademy.com/blog/what-is-data-model-in-dbms-and-what-are-
e its-types
2. https://www.pcmag.com/encyclopedia/term/data-element

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Two Ending 2nd Oct, Time: 1:45-2:30 PM Class Size: Sex: Mixed
2022 15
Date Duration: 45
28th September, 2022 Minutes

Topic Data Modelling I

Objectives By the end of the lesson, the learners should be able to;
1. Create tables
2. Create forms
3. Create queries
4. Create reports
5. Appreciate the need for database tools
Correctly and satisfactorily using the instructional resources provided as guide.
Instructional Charts, Microsoft Access package
Resources

Entry The facilitator introduces the lesson by reviewing the learner’s knowledge on the last lesson. The topic
Behaviour was introduced in the last class

Instructional Step 1: Introduction


Procedure Data Modelling refers to the way data is structured in a database to enable the processing of information
It is sometimes called database modelling because a data model is eventually implemented in a database.

A database is an organized collection of data generally stored and accessed electronically. A database
can contain many tables, each containing information about a particular subject. Some examples of
Step 1 databases include: Microsoft Access, SQL, Oracle, CoucheDB

A table is a collection of data about a specific topic. It can be seen like a folder in a file cabinet. A table
consists of records and fields

A record is a collection of related fields e.g the name, sex, age, address and other details of a student
make up his record

A field refers to a specific item in a table e.g serial number, name, sex, date, year of enrollment etc
Every item within the same field must be of the same data type

Data Types
Some commonly used data types in databases include
1. Numbers
2. Characters
3. Alphanumeric
4. Memo
Step 2 5. Time stamp
6. Boolean
Database Objects
A database object is any defined object in a database that is used to store or reference data

Databases in Microsoft Access are composed of four objects: tables, queries, forms, and reports.
Together, these objects allow you to enter, store, analyze, and compile your data however you want.

Activity 1: Creating database tables


Using MS Access
1. Create a table with the following fields: Registration number, name, sex, date of birth, year of
enrollment
2. The table should contain 10 records
Hint:
i. Launch Microsoft Access program
ii. Click blank database and create new
iii. Right click on table 1, click design view
iv. Populate the database table and save

Forms
A form is a database object that you can use to enter, edit, or display data from a table or a query. You can
use forms to control access to data, such as which fields of data are displayed

Activity 2: Creating forms


Hint:
i. Select “forms” tab and click New
ii. Select “Form wizard” and click “OK”
iii. Select the fields needed on your form and click “Next”

Queries
A query refers to the action of instructing the database to return some (or all) of the data in your database.
In other words, you are querying the database for some data that matches a given criterion
For example, you might want to see a list of individuals whose first name is David

Activity 3: Creating queries


Hint:
i. Select “query” tab and click “New”
ii. Select “Simple Query Wizard” and click “OK”
iii. Choose the required field and next. Then click finish

Reports
A report is a formatted and organized presentation of data
Reports enable you to format your data in an attractive and informative layout for printing or viewing on
screen. Reports are often used to present a big-picture overview, highlighting main facts and trends

Activity 4: Creating Reports


Hint:
i. Select the database file to report
ii. Select the “Create” tab and select “Report Wizard”
iii. Choose the fields to report and click finish

1. Explain the purpose of querying a database


Evaluation 2. Enumerate the steps required to create a report

Summary Database tools such as query, report and form help in better organization and management of a database.
The main aim of data modeling is to support the development information systems. It does this by
providing the definition and structure of data

Assignment 1. State the components of a standard data model


2. Explain the term Normal form
References https://docs.oracle.com/middleware/12212/bip/BIPDM/GUID-2632C713-0689-42FB-B081-
8940F0BBCE72.htm#BIPDM126

Teache Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
r Processing 11

Week Week Three Ending 9th Oct, Time: 1:45-2:30 PM Class Size: 15 Sex: Mixed
2022
Date Duration: 45 Minutes
5th October, 2022

Topic Data Modelling II


By the end of the lesson, the learners should be able to
Objectives
1. Enumerate the significance of data models
2. Explain the cases where data models are used
3. State examples of standard data models
4. Examine the components of a standard data model
Correctly and satisfactorily using the instructional resources provided as guide
Charts, Microsoft Access package
Instructional
Resources

Entry Behavior The facilitator introduces the lesson by reviewing the learner’s knowledge on the last lesson. The topic
was introduced in the last class
Step 1: Significance of data model
Instructional
1. The main aim of data models is to support the development of information systems by
Procedure
providing the definition and format of data. A data model clearly determines the structure of
data.

2. Data models are often used as an aid to communication between the business people
defining the requirements for a computer system and the technical people defining the
design in response to those requirements.

3. Data models describe structured data for storage in data management systems such as
relational databases. They typically do not describe unstructured data, such as word
processing documents, email messages, pictures, digital audio and video.

4. A data model is the medium which project team members from different backgrounds and
with different levels of experience can communicate with one another.

Standard data models


A standard data model or industry standard data model (ISDM) is a data model
applied in some industry, and shared amongst competitors to some degree. They are often defined
by standard bodies, database vendors or operating system vendors .

Examples of Standard data models


1. Financial Industry Business Data Model (FIB-DM) is a relational standard derived from the
reference ontology for banks and investment companies
2. ISO 10303: CAE Data Exchange Standard - includes its own data modelling language,
EXPRESS
3. ISO 15926: Process Plants including Oil and Gas Facilities Life-Cycle data
Evaluation 1. Explain the significance of data model
2. State the components of a standard data model

Summary The significance of data models can never be over emphasized. A data model not only improves the
conceptual quality of an application, it also lets you leverage database features that improve data
quality.

Assignment 1. Enumerate more examples of standard data models in use today

https://docs.oracle.com/middleware/12212/bip/BIPDM/GUID-2632C713-0689-42FB-B081-
References
8940F0BBCE72.htm#BIPDM126

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Four Ending 16th Oct, Time: 1:45-2:30 PM Class Size: Sex: Mixed
2022 15
Date Duration: 45
12th October, 2022 Minutes

Topic Normal Forms I


Objectives By the end of the lesson, the learners should be able to
1. Explain the term normal form
2. Enumerate the types of normal forms
3. Describe the rules for tables to be in first normal and second normal forms
4. Demonstrate the process of converting tables from first to second normal form
5. Examine the problems with tables in first normal form
Correctly and satisfactorily using the instructional resources provided as guide
Instructional Resources Charts, slide shows
Instructional Techniques Discussions and Discovery, Questioning, Demonstration, Visual imagery
Entry Behavior The facilitator introduces the lesson by reviewing the learner’s knowledge on the last lesson.
Instructional Procedure Step 1: Introduction

A Normal Form is a rule that determines the degree of consistency of a database table. This
Step 1 means checking the relational database redundancy and ensure data dependency (When
information stored on the same database table uniquely determines other information stored on
the table. E.g. Name and other attributes depending on Reg. no. for uniqueness in a table).

Normalization is the process of removing existing or possible incidences of data redundancies,


and data inaccuracy in a database.

Databases have to go through the process of normalization. This is to ensure that all data
entered are accurate, and has no redundancy.

Normalization is carried out through the use of normal forms. For the scope of this lesson, we
are going to dwell on the first three normal forms

First Normal Form (1st NF)


For a database table to be in 1st NF, it has to satisfy the following conditions
1. It should only have single (atomic) valued attributes/columns.
Step 2 2. Values stored in a column should be of the same domain
3. All the columns in a table should have unique names
4. And the order in which data is stored, does not matter.

ACTIVITY 1: Convert the table below to 1st NF

Reg no Name Subject


101 Oduenyi English, Maths
103 Prince Econs
102 Hannah French, Literature

Solution
Reg no Name Subject
Step 3 101 Oduenyi English
101 Oduenyi Maths
103 Prince Econs
102 Hannah French
102 Hannah Literature

Problems with tables in 1st NF


1. It is not possible to insert new records
2. Deleting a field value results in loss of other fields
3. Renaming a field value necessitates updating of all records relating to that field value

Second Normal Form (2nd NF)


For a table to be in the Second Normal Form, it must satisfy two conditions:
1. The table should be in the First Normal Form.
2. All no-key attributes are fully dependent on the primary key

Consider the table below


Purchase_detail
Customer_ID Store_ID Purchase_Location
1 1 Lagos
1 3 Owerri
2 1 Lagos
3 2 Aba
4 3 Owerri

This table has a composite key [Customer ID, Store ID].


A Composite key is a key of two or more attributes that uniquely identifies a row
The non-key attribute is [Purchase_Location]. In this case, [Purchase_Location] only depends
on [Store_ID] which is only part of the primary key. This table therefore does not satisfy
second normal form

To put this table in normal form, we have to remove [Purchase_Location] from the table. WE
will have two tables thus
TABLE_PURCHASE TABLE_STORE
Customer_ID Store_ID Store_ID Purchase_Location
1 1 1 Lagos
1 3 2 Aba
2 1 3 Owerri
3 2
4 3

The functional dependency has been removed. In each of the tables, there is fully dependency
on the primary key
Evaluation 1. Explain the term Normal Forms
2. Define Normalization
3. State the problems involved with tables in 1st NF
Summary Relational databases are normalized in order to eliminate redundancy and functional
dependency. When tables are normalized, the data becomes reliable and easy to organize. The
first and second normal forms that we have seen have rules which lead a relational database to
normalization
Assignment State the conditions needed for third NF to be satisfied
References 1. https://www.studytonight.com/dbms/database-normalization.php
2. https://stackoverflow.com/questions/5610226
3. Milestone for data processing pg17

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Five Ending 23rd Oct, Time: 1:45-2:30 PM Class Size: Sex: Mixed
2022 15
Date Duration: 45
19th October, 2022 Minutes
Topic Continuous Assessment Test (CAT)

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Six Ending 30th Oct, Time: 1:45-2:30 PM Class Size: Sex: Mixed
2022 15
Date Duration: 45
26 October, 2022
th
Minutes
Topic Normal Forms II
Objectives By the end of the lesson, the learners should be able to
1. Identify determinants on a database table
2. Convert database tables to 3rd normal form
3. Explain the concept of foreign keys
4. Appreciate the need for higher order of normal forms
Correctly and satisfactorily using the instructional resources provided as guide
Instructional Resources Charts, slide shows, MS Access Package
Instructional Techniques Discussions and Discovery, Questioning, Demonstration, Visual imagery
Entry Behaviour The facilitator introduces the lesson by reviewing the learner’s knowledge on the last lesson.
Instructional Procedure Step 1
A determinant in a database table is any attribute that you can use to determine the values
assigned to other attribute(s) in the same row
Step 1
Consider the following table
STUDENT
Student_id First_name Last_name Date_of_birth
1 Belinda Michael Feb 15, 1990
2 Fritz Gerald June 12 2001
3 Jack Nicholas September 3, 1980

In this case, the field student_id determines the remaining three fields. The name fields do
not determine the student_id because the school may have more than one student with the
same first and/or last name. Similarly, the DOB field does not determine the student_id or the
name fields because more than one student may share the same birthday.

Step 2 Third Normal Form


A database is in 3rd NF if it satisfies the following conditions:
 It is in 2nd NF
 There is no transitive functional dependency

ACTIVITY I
Bring the table below to third normal form
BOOK_DETAIL
Book_id Genre_id Genre_type Price
1 1 Fishery 20.00
2 2 Sports 32.67
3 1 Fishery 54.13
4 3 Gardening 45.00
5 2 Sports 54.60
Step 3
Hint:
1. Identify the determinants
2. Break down the table into two

Concept of Foreign Keys


A foreign key is a column or group of columns in a relational database table that provides a
link between data in two tables. It acts as a cross-reference between tables because it
references the primary key of another table, thereby establishing a link between them.
The majority of tables in a relational database system adhere to the foreign key concept.
The table containing the foreign key is called the referencing or child table, and the table
containing the candidate key is called the referenced or parent table.
Since the purpose of the foreign key is to identify a particular row of the referenced table, it
is generally required that the foreign key is equal to the candidate key in some row of the
primary table, or else have no value (the NULL value. This rule is called a referential
integrity constraint between the two tables. Because violations of these constraints can be the
source of many database problems, most database management systems provide mechanisms
to ensure that every non-null foreign key corresponds to a row of the referenced table.

Evaluation 1. Explain the meaning of determinants in a database


2. State the conditions for a database to be in 3rd NF
3. Define referential integrity
Summary A database table has to be in 3rd NF so as to avoid redundancy and make data more reliable.
For two tables to be linked, there has to be the presence of a foreign key on the other table.
This enables referential integrity
Assignment 1. Enumerate the advantages of foreign key in a database table
2. Carry out a research to find out if there are higher normal forms
Reference 1. https://stackoverflow.com/questions/16706637/are-determinants-and-candidate-keys-
same-or-different-things/16707011
2. Milestone for data processing pg20

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Seven Ending 6th Time: 1:45-2:30 PM Class Size: Sex: Mixed
Nov, 2022 15
Date Duration: 45
2 November, 2022
nd
Minutes

Topic Mid Term Break

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Eight Ending 13th Time: 1:45-2:30 PM Class Size: Sex: Mixed
Nov, 2022 15
Date Duration: 45
9th November, 2022 Minutes

Topic Entity Relationship Model


Objectives By the end of the lesson, the learners should be able to
1. Define entities
2. Define attributes
3. Explain the relationship between entities
4. Identify objects around an entity set
Correctly and satisfactorily using the instructional resources provided as guide
Instructional Resources Charts, PowerPoint presentations
Instructional Techniques Discussions and Discovery, Questioning, Demonstration, Visual imagery
Entry Behaviour The facilitator introduces the lesson by reviewing the learner’s knowledge on the last lesson.
Instructional Procedure Step 1
Entity-Relationship Model (ERM)
An ERM is a data model that describes interrelated things of interest in a specific domain of
knowledge
A basic ER Model is composed of entity types (which classify the things of interest),
attributes (which is a description of these entities) and specifies relationships that can exist
between entities
An ERM is modelled in such a way that it lends itself to be ultimately implemented in a
database, such as a relational database
This model is represented using an ERD (Entity-Relationship Diagram)

Definition of terms
Entity: An entity is a person, place, concept or thing about which the business needs data
Attributes: Attributes are descriptive properties of an entity. Examples include name, age,
salary, price, etc.
Relationship: This is an association between entity types. A relationship captures how
entities are related to one another. Relationships can be thought of as verbs linking two or
more nouns. In the diagram above, the relationship between Student and College is Study

Steps in ER Modelling
1. Understand the problem situation
2. Identify the entity types
3. Determine and refine the relationships among the entity types
4. Represent the problem in the language of ER Modelling
Evaluation 1. Define the terms entities, relationships and attributes
2. What is used to represent an ER Model?
Summary The main components of an ER Model are Entities and the relationships between them.
These entities are described by attributes. Relationships can be thought of as verbs.
Assignment 1. Identify objects around us as entity sets. Explain the relationships that exist between
them
2. Define a relational model database
Reference 1. https://beginnersbook.com/2015/04/e-r-model-in-dbms/#:
2. Milestone for data processing pg23

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Nine Ending 20th Time: 1:45-2:30 PM Class Size: Sex: Mixed
Nov, 2022 15
Date Duration: 45
16th November, 2022 Minutes
Topic Relational model I
Objectives By the end of the lesson, the learners should be able to
1. Define a relational model
2. Explain how data is represented
3. Create and modify data in a relational model
4. Manipulate and query data
5. Design a relational database model
Correctly and satisfactorily using the instructional resources provided as
guide
Instructional SQL software, charts, PowerPoint presentation
Resources
Instructional Discussions and Discovery, Questioning, Demonstration, Visual imagery
Techniques
Entry Behavior The facilitator introduces the lesson by reviewing the learner’s knowledge
on the last lesson.
Instructional Step 1: Introduction
Procedures A relational database is a representation of how data is stored in a relational
database

A relational database stores data in tables. Tables are organized into


columns (known as fields), and each column stores one type of data (integer,
real number, character strings, date, etc). The data for a single “instance” of
a table is stored as a row (known as record)

Representation of data in a relational database model


In a relational database, data is arranged on tables, and each table has a
unique field that identifies all the other fields. This unique field is known as
the primary key. The tables in the database are all related to each other
through either one-to-one, one-to-many or many-to-many relationship. The
presence of foreign keys facilitates the relationships between tables

Creating and modifying relations using SQL


To create tables using SQL, the following syntax is used
CREATE TEBLE <table name> (<list of fields, their types and
parameters>)
For example:
CREATE TABLE Employee
(EmployeeID INT Primary key,
Lastname VARCHAR2 (20) NOT NULL,
Firstname VARCHAR2 (20) NOT NULL,
Gender CHAR (2),
DOB DATE

When we modify the tables, it means we are adding or deleting a row or


column of data on the table.
Modifications include any of the following
INSERT statement
ALTER TABLE statement
SELECT FROM statement
SELECT * FROM statement

Querying data on a database


When querying data from SQL, the SELECT statement is used

Some examples of relational databases are; MS Access, MS SQL, oracle,


MySQL

Evaluation 1. Define relational database model


2. List some statements used in manipulating data in SQL
Summary Relational databases arrange data in tables comprising of rows and columns.
These tables are related to each other through a foreign key. These
relationships help to enforce data integrity
Assignment 1. Explain the terms entity integrity and referential integrity
Reference 1. https://opentextbc.ca/dbdesign01/chapter/chapter-7-the-relational-
data-model/
2. https://www.g2.com/categories/relational-databases
3. Milestone for data processing by Oparah I.W pg 26

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Ten Ending 27th Nov, Time: 1:45-2:30 PM Class Size: Sex: Mixed
2022 15
Date Duration: 45
23rd November, 2022 Minutes

Topic Relational Model II


Objectives By the end of the lesson, the learners should be able to
1. Define data integrity
2. Explain integrity constraints
3. Enumerate the three types of integrity constraints
4. List examples of integrity constraints
Correctly and satisfactorily using the instructional resources provided as guide
Instructional Resources SQL software, charts, PowerPoint presentation
Instructional Discussions and Discovery, Questioning, Demonstration, Visual imagery
Techniques
Entry Behavior The facilitator introduces the lesson by reviewing the learner’s knowledge on the last lesson.
Instructional Procedure Step 1: Data Integrity
Data integrity is the maintenance of, and the assurance of, the accuracy and consistency of data
over its entire life-cycle

Integrity constraints
Integrity constraints are a set of rules which ensure that the data insertion, updating, and other
processes have to be performed in such a way that data integrity is not affected.
It is used to maintain the quality of information

Types of integrity constraints


There are three types of integrity constraints which include entity, domain and referential
integrity
1. Entity integrity concerns the concept of a primary key. Entity integrity is an integrity
rule which states that every table must have a primary key and that the column or
columns chosen to be the primary key should be unique and not null
2. Referential Integrity: A referential integrity constraint is specified between two tables.
In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary
Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be
available in Table 2.
3. Domain Integrity: Domain constraints can be defined as the definition of a valid set of
values for an attribute. The data type of domain includes string, character, integer, time,
date, currency, etc. The value of the attribute must be available in the corresponding
domain.

Advantages of Integrity constraints


 Declarative ease: Because you define integrity constraints using SQL statements, no
additional programming is required when you define or alter a table. The SQL
statements are easy to write and eliminate programming errors.

 Centralized rules: Integrity constraints are defined for tables and are stored in the data
dictionary (see "Overview of the Data Dictionary"). Thus, data entered by all
applications must adhere to the same integrity constraints. If the rules change at the
table level, then applications need not change. Also, applications can use metadata in
the data dictionary to immediately inform users of violations, even before the database
checks the SQL statement.

 Flexibility: when loading data, you can disable integrity constraints temporarily to
avoid performance overhead when loading large amounts of data. When the data load is
complete, you can re-enable the integrity constraints.

Examples of commonly used integrity constraints: NOT NULL, Unique Key, Primary Key,
Foreign key, Check
Evaluation 1. Define data integrity
2. Explain the types of integrity constraints
Summary A database has to have integrity, so that data can be manipulated and stored effectively. For this
to happen, integrity constraints are used
Assignment 1. Explain the different file organization methods
References 1. https://en.wikipedia.org/wiki/Data_integrity
2. https://www.javatpoint.com/dbms-integrity-constraints#:~:text=Integrity%20constraints
%20are%20a%20set%20of%20rules.&tex
3. https://docs.oracle.com/cd/E11882_01/server.112/e40540/datainte.htm#CNCPT33334

Teacher Mr. Njoku Callistus O. Subject: Data Class: Grade Age: 14+
Processing 11

Week Week Eleven Ending 11th Time: 1:45-2:30 Class Size: Sex: Mixed
Dec, 2022 PM 15
Date
7th Dec, 2022 Duration: 45
Minutes

Topic Revision

You might also like