0% found this document useful (0 votes)
4 views

DBMS2

Uploaded by

yibebra240
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

DBMS2

Uploaded by

yibebra240
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 150

FUNDAMENTALS OF DATABASE

SYSTEMS

By
Aklilu Elias (MIT)
Email
[email protected]
[email protected]
Contact:- +251 916 48 5472
+251 945 00 3945

1 Prepared by Aklilu E. @WSU


Chapter One
 1.1 Introduction
 1.2 Data Handling approaches
 1.3 Roles in Database Design and
Development
 1.4 The ANSI/SPARC and Database
Architecture
 1.5 Types of Database System
 1.6 Database Management System (DBMS)
 1.7 Data models and conceptual models

2 Prepared by Aklilu E. @WSU


Introduction
 Database is a shared collection of logically
related data and its description, designed to
meet the information needs of an organization.
 It is a single, possibly large repository of data
that can be used simultaneously by many
departments and users.
 It is no longer owned by one department but is a
shared corporate/company resource.
 It holds the organization‘s operational data, in
addition to a description of this data i.e meta
data.
 For this reason, a database is also defined as a
self-describing collection of integrated records.
3 Prepared by Aklilu E. @WSU
Introduction…
 The users of an object see only the external
view of database
 They are unaware of how the object is defined
and how it functions.
 One advantage of this approach, known as
data abstraction,
 Data abstraction is to mean we can change
the internal definition of an object without
affecting the users of the object, provided that
the external definition remains the same.

4 Prepared by Aklilu E. @WSU


Introduction…
 Database approach separates the structure of the data
from the application programs and stores it in the
database.
 If new data structures are added or existing structures are
modified, then the application programs are unaffected.
 Database is logically related.
 When we analyze the information needs of an
organization, we attempt to identify entities, attributes,
and relationships.
 An entity is a real world object (a person, place, thing,
concept, or event) in the organization that is to be
represented in the database.
 An attribute is a property that describes some aspect of
the object (entity) that we wish to record, and
 A relationship is an association between entities
5 Prepared by Aklilu E. @WSU
Introduction…
 Databases and database systems are an essential
component of life in modern society:
 Most of us encounter several activities every day that
involve some interaction with a database;
 for example, if we go to the bank to deposit or
withdraw funds.
 These activities will involve someone or some
computer program accessing a database;
 We may call this traditional database
applications, in which most of the information that
is stored and accessed is either textual or numeric.
 In the past few years, advances in technology have
led to exciting new applications of database systems.
6 Prepared by Aklilu E. @WSU
Introduction…
 The explosion of social media Web sites, such as
Facebook, Twitter, telegram many others, has required
the creation of huge databases that store non-
traditional/Modern data, such as posts, tweets,
images, and video clips.
 New types of database systems, often referred to as big
data storage systems, or NOSQL systems, have been
created to manage data for social media applications.
 These types of systems are also used by companies such
as Google, Amazon, and Yahoo, to manage the data
required in their Web search engines, plus to provide
cloud storage,
 Users are provided with storage capabilities on the Web
for managing all types of data including documents,
programs, images, videos and emails.
7 Prepared by Aklilu E. @WSU
Some other databases
applications
 Photo and video technology on cell phones and other
devices has made it possible to store images, audio
clips, and video streams digitally.
 These types of files are becoming an important
component of multimedia databases.
 Geographic information systems (GISs) can store and
analyze maps, weather data, and satellite images.
 Data warehouses and online analytical
processing (OLAP) systems are used in many
companies to extract and analyze useful business
information from very large databases to support
decision making.
 Real-time and active database technology is used
to control industrial and manufacturing processes.
8 Prepared by Aklilu E. @WSU
Some other databases
applications
 And database search techniques are being
applied to the World Wide Web to improve
the search for information that is needed by
users browsing the Internet.
 Databases and database technology have
had a major impact on the growing use of
computers.
 Databases play a critical role in almost
all areas where computers are used,
including business, electronic commerce,
social media, engineering, medicine, genetics,
law, education, and library science.
9 Prepared by Aklilu E. @WSU
Data, Database, Database Systems
and Database Management System
 Data known facts that can be recorded and that have implicit
meaning. Eg; names, telephone numbers, and addresses of the
people you know.
 A database is a collection of related data.
 It is also called collection of related data with an implicit meaning.
 Database has the following implicit properties:
 A database represents some aspect of the real world, sometimes
called the mini world or the universe of discourse (UoD).
 Changes to the mini world are reflected in the database.
 A database is a logically coherent collection of data with some
inherent meaning.
 A random assortment of data cannot correctly be referred to as a
database.
 A database is designed, built, and populated with data for a
specific purpose.
 It has an intended group of users and some defined applications in
which these users are interested
10 Prepared by Aklilu E. @WSU
Data, Database, Database Systems
and Database Management System…
 The database is now such an integral part of
our day-to-day life that often we are not aware
that we are using one.
 A database system (DB application) is simply
a program that interacts with the database at
some point in its execution.
 Database management system (DBMS) to be
the software that manages and controls
access to the database.
 Database system as a collection of application
programs that interact with the database
along with the DBMS and the database itself.
11 Prepared by Aklilu E. @WSU
DBS and DBMS
 Organizations must have accurate and reliable data for
effective decision making.
 A database system is an integrated collection of
related files, along with details of the interpretation of
the data contained therein.
 Database system is nothing more than a computer-
based record keeping; as the overall purpose of DB is
to record and maintain data/information.
 A database management system (DBMS) is a software
system that allows access to data contained in a
database.
 The objective of the DBMS is to provide a convenient
and effective method of defining, storing and
retrieving the information contained in the database.
12 Prepared by Aklilu E. @WSU
DBS and DBMS
 DBMS exerts centralized control of the database, prevents
fraudulent or unauthorized users from accessing the data,
and ensures the privacy of the data.
 Generally a database is an organized collection of related
information.
 The term ‘DATA’ can be defined as the value of an
attribute of an entity.
 Any collection of related data items of entities having the
same attributes are called ‘DATABASE’.
 Simply random collection of data does not make it a
database; rather the way it is organized for effective and
efficient use makes it a database.
 Database technology is “one of the most rapidly growing
areas of computer and information science”.
 It13is emerged in the late
Prepared by Aklilu E. @WSU
1600 as a result of combination of
Entities, Entity sets and Attributes
 The technology that emerged to process data of various
kinds is grossly termed as ‘Database Management
Technology’
 The resulting software are known as ‘Database Management
System’ (DBMS) which they manage a computer stored
database or collection of data.
 An entity: - concrete as person or book, etc.
 An entity set is a set of entities of the same type that share
the same properties or attributes.
 An entity is represented by set of attributes.
 An attribute is also referred as data item, data element, data
field, etc.
 Attributes are descriptive properties possessed by each
member of an entity set.
 A grouping of related entities becomes an entity set.
14 Prepared by Aklilu E. @WSU
Examples
 In a library environment,
 Entity Set: -Catalogue – what we commonly say shelf
 Entity: -of Books, Journals, AV-Materials, etc
 Attributes: – contains ISBN, title, author, or publisher,
etc.
 The objective of database is to record and maintain
information.
 The primary function of the database is the service and
support of information system which satisfies cost.
 A database is an organized collection of related
information stored with minimum redundancy, in a
manner that makes them accessible for multiple
applications”.
15 Prepared by Aklilu E. @WSU
1.2 Data Handling Approaches
1. Manual Data Handling approach
 In this approach, data storage and retrieval follows
the primitive and traditional way of information
handling where cards and paper are used for the
purpose.
 The data storage and retrieval will be performed using
human labor.
 Each of the files containing various kinds of information is
labelled and stored in one or more cabinets.
 The cabinets could be kept in safe places for security
purpose based on the sensitivity of the information
contained in it.
 Insertion and retrieval is done by searching first for the
right cabinet then for the right the file then the
information.
16 Prepared by Aklilu E. @WSU
Data Handling Approaches…
 Limitations of the Manual data handling
approach
 Prone to error
 Difficult to update, retrieve, integrate
 You have the data but it is difficult to compile the
information
 Limited to small size information
 Cross referencing is difficult
 An alternative approach of data handling is a
computerized way of dealing with the information.
 This approach could also be either decentralized or
centralized base on where the data resides in the
system.
17 Prepared by Aklilu E. @WSU
Data Handling Approaches…
2. Traditional File Based Data Handling approach
 File based systems were an early attempt to
computerize the manual filing system.
 It is the decentralized computerized data handling
method.
 A collection of application programs perform services for
the end-users.
 Every application program that provides service to end
users define and manage its own data
 Since every application defines and manages its own
data, the system is subjected to serious data duplication
problem.
 File, in traditional file based approach, is a collection of
records which contains logically related data
18 Prepared by Aklilu E. @WSU
Limitations of the Traditional File
Based approach
 The limitations include, but not limited to:
 Separation or Isolation of Data: Available
information in one application may not be
known.
 Data Synchronization/management is done
manually.
 Limited data sharing- every application
maintains its own data.
 Lengthy development and maintenance time
 Duplication or redundancy of data (money and
time cost and loss of data integrity)
 Incompatible file formats or data structures etc.
19 Prepared by Aklilu E. @WSU
Limitations…
 The most significant problem experienced by the
traditional file based approach of data handling
can be formalized by update anomalies
 We have three types of update anomalies;
 1. Modification Anomalies: a problem happens when
one ore more data value is modified on one application
program but not on others containing the same data
set.
 2. Deletion Anomalies: a problem encountered where
one record set is deleted from one application but
remain untouched in other application programs.
 3. Insertion Anomalies: a problem encountered
whenever there is new data item to be recorded, and
the recording is not made in all the applications.
20 Prepared by Aklilu E. @WSU
1.2.3 Database Data Handling
approach
 This method allows user with a view of data organized as tables
called relations.
 Unlike the user of earlier database systems, the user of a
relational system would not be concerned with the storage
structure.
 Queries could be expressed in a very high-level language, which
greatly increased the efficiency of database programmers.
 The database approach emphasizes the integration and sharing
of data throughout the organization.
 Unlike the traditional file based approach in database approach
there is program data independence; the separation of the data
definition from the application.
 Thus the application is not affected by changes made in the
data structure and file organization.
 Each database application will perform the combination of:
Creating database, Reading, Updating and Deleting data.
21 Prepared by Aklilu E. @WSU
Benefits of the database approach
 Data can be shared: two or more users can access and use same
data instead of storing data in redundant manner for each user.
 Improved accessibility of data: by using structured query
languages, the users can easily access data without programming
experience.
 Redundancy can be reduced: isolated data is integrated in database
to decrease the redundant data stored at different applications.
 Quality data can be maintained: the different integrity constraints
in the database approach will maintain the quality leading to better
decision making
 Inconsistency can be avoided: controlled data redundancy will
avoid inconsistency of the data in the database to some extent.
 Transaction support can be provided: basic demands of any
transaction support systems are implanted in a full scale DBMS.

22 Prepared by Aklilu E. @WSU


Benefits of the database
approach…
 Integrity can be maintained: data at different
applications will be integrated together with additional
constraints to facilitate validity and consistency of
shared data resource.
 Security measures can be enforced: the shared data
can be secured by having different levels of clearance
and other data security mechanisms.
 Improved decision support: the database will provide
information useful for decision making.
 Standards can be enforced: the different ways of using
and dealing with data by different unite of an
organization can be balanced and standardized by
using database approach.

23 Prepared by Aklilu E. @WSU


Benefits of the database
approach…
 Compactness: since it is an electronic data
handling method, the data is stored
compactly (no voluminous papers)
 Speed: data storage and retrieval is fast as
it will be using the modern fast computer
systems.
 Less labour: unlike the other data handling
methods, data maintenance will not
demand much resource.
 Centralized information control: since
relevant data in the organization will be
stored at onePrepared
24 repository,
by Aklilu E. @WSU it can be
Limitations and risk of Database
Approach
 Introduction of new professional and specialized
personnel
 Complexity in designing and managing data
 The cost and risk during conversion from the old to
the new system
 High cost to be incurred to develop and maintain
the system
 Complex backup and recovery services from the
users perspective
 Reduced performance due to centralization and
data independency
 High impact on the system when failure occurs to
the central system
25 Prepared by Aklilu E. @WSU
Roles in Database Design and
Development
 As people are one of the components in DBMS environment,
there are group of roles played by different stakeholders of
the designing and operation of a database system.
1. Database Designer
 Database designers are responsible for identifying the data
to be stored in the database and for choosing appropriate
structures to represent and store this data.
 Can be grouped as
 Logical database designers and
 Physical database designers.
 The logical db designer is concerned with identifying the data (the
entities and attributes), the relationships between the data, and
the constraints on the data that is to be stored in the database.
 The logical db designer must have a in-depth and complete
understanding of the organization‘s data and any constraints on
this data (the constraints are sometimes called business rules).
26 Prepared by Aklilu E. @WSU
Database Designer…
 The work of the logical database designer is categorized two
stages:
 Conceptual database design, which is independent of
implementation details, such as the target DBMS, application
programs, programming languages, or any other physical
considerations;
 Logical database design, which targets a specific data model,
such as relational, network, hierarchical, or object-oriented.
 The physical database designer decides how the logical
database design is to be physically realized.
 This involves:
 Mapping the logical database design into a set of tables and
integrity constraints;
 Selecting specific storage structures and access methods for the
data to achieve good performance;
 Designing any security measures required on the data.

27 Prepared by Aklilu E. @WSU


1.3.2 Database Administrator
 Responsible to oversee, control and manage
the database resources (the database itself,
the DBMS and other related software)
 Authorizing access to the database
 Coordinating and monitoring the use of the
database
 Responsible for determining and acquiring
hardware and software resources
 Accountable for problems like poor security,
poor performance of the system
 Involves in all steps of database development
28 Prepared by Aklilu E. @WSU
Database Administrator…
 Data Administrator (DA): is responsible on management
of data resources; i.e database planning, development,
maintenance of standards policies and procedures at the
conceptual and logical design phases.
 It is more technically oriented role.
 DBA is responsible for the physical realization of the
database.
 It is involved in physical design, implementation, security
and integrity control of the database.
 In a database environment, the primary resource is the
database itself, and the secondary resource is the DBMS
and related software.
 Administering these resources is the responsibility of the
database administrator (DBA).
29 Prepared by Aklilu E. @WSU
1.3.3 Application Developers
 Once the database has been implemented, the
application programs that provide the required
functionality for the end-users must be implemented.
 This is the responsibility of the application developers.
 Typically, the application developers work from a
specification produced by systems analysts.
 Each program contains statements that request the
DBMS to perform some operation on the database,
which includes retrieving data, inserting, updating, and
deleting data.
 The programs may be written in a third-generation or
fourth-generation programming language, as
discussed previously.

30 Prepared by Aklilu E. @WSU


1.3.4 End-Users
 End users are the people whose jobs require access to
the database for querying, updating, and generating
reports; the database primarily exists for their use.
 There are several categories of end users:
 Casual end users: - occasionally/sometimes access
the database, but they may need different information
each time.
 Naive or parametric end users: - make up a
sizable portion of database end users.
 Their main job function revolves around constantly
querying and updating the database, using standard
types of queries and updates called canned/artificial
transactions that have been carefully programmed and
tested.
31 Prepared by Aklilu E. @WSU
End Users…
 Sophisticated end users: include engineers,
scientists, business analysts, and others who
carefully familiarize themselves with the
facilities of the DBMS in order to implement
their own applications to meet their complex
requirements.
 Standalone users: - maintain personal
databases by using ready-made program
packages that provide easy-to-use menu-
based or graphics-based interfaces.
 An example is the user of a financial software
package that stores a variety of personal
financial data.
32 Prepared by Aklilu E. @WSU
1.4 Database Architecture
 Provides a basis for understanding some of the
functionality of a DBMS.
 The purpose and origin of the Three-Level
database architecture
 All users should be able to access same data.
 A user’s view is unaffected or immune to changes made
in other views.
 Users should not need to know physical database storage
details.
 DBA should be able to change database storage
structures without affecting the users’ views.
 A change in file organization, access method should not
affect the structure of the data which in turn will have no
effect on the users.
33 Prepared by Aklilu E. @WSU
 Internal structure of database should be unaffected by
The American National Standards Institute (ANSI)
Standards Planning and Requirements Committee
(SPARC).
 This standard recognized the need for a three-level
approach with a system catalog.
 The three-levels of architecture are: - External level,
conceptual level and internal level.
 The external level: - the way users perceive the data
(EU)
 The internal level; - the way the DBMS and the operating
system perceive the data, (DBAD)
 Conceptual level: - the way that data is actually stored
using the data structures and file. (DBA)
 External level: The users‘ view of the database.
 Conceptual level: The community view of the database.
 Internal level: The physical representation of the
database on the computer.
34 Prepared by Aklilu E. @WSU
DB Architecture

35 Prepared by Aklilu E. @WSU


Types of Database Systems
1.5.1 Client-Server Database System
 Client/server is developed to deal with various
computing environments that have a large number of
computers and servers connected together via a
network.
 In this architecture, a Client is a user machine which
provides the user interface and local processing
capabilities.
 When any client requires additional functionality like
database access, it can connect to Server that is
capable of providing the functionality needed by the
client.
 Basically Server is a machine that provides services to
the Client i.e. user machine.
36 Prepared by Aklilu E. @WSU
Advantages of client server
database system
 It has less expensive platforms to support applications
 Client offer icon-based menu-driven interface, which is
superior to the traditional command-line, dumb terminal
interface typical of mini and mainframe computer
systems.
 facilitates in more productive work by the users and
making better use of existing data.
 is more flexible as compared to the Centralized system.
 Response time and throughput is high.
 Provides a better DBMS performance.
 Provides better interfaces, high availability, faster
responses and overall improved ease of use to the user.
 A single database (one server) can be shared across
several distinct client (application) systems
37 Prepared by Aklilu E. @WSU
Disadvantages of Client/Server
Database System
 Programming cost is high in client/server
environments, particularly in initial phases.
 There is a lack of management tools for diagnosis,
performance monitoring and tuning and security
control, for the DBMS, client and operating systems
and networking environments.
Parallel Database System
 Consists of a multiple Central Processing Units (CPUs)
and data storage disk in parallel.
 They improve processing and Input/ Output (I/O)
speeds.
 Are used in the application that have to query
extremely large databases or that have to process an
extremely large number of transactions per second.
38 Prepared by Aklilu E. @WSU
Advantages of a Parallel Database
System
 Are very useful for the applications that have to
query extremely large databases
 The number of tasks that can be completed in a
given time interval and the amount of time it takes
to complete a single task from the time are very
high.
Disadvantages of a Parallel Database System
 The startup cost associated with initiating a single
process and the startup-time may overshadow the
actual processing time, affecting speedup badly.
 It access shared resources, for that matter
slowdown may result from interference of each
new process.
39 Prepared by Aklilu E. @WSU
Distributed Database System
 A logically interrelated collection of shared data physically
distributed over a computer network is called as distributed
database
 The software system that permits the management of the
distributed database and makes the distribution transparent to
users is called as Distributed DBMS.
 It consists of a single logical database that is split into a number of
fragments.
 Each fragment is stored on one or more computers under the
control of a separate DBMS, with the computers connected by a
communications network.
 As shown, in distributed database system, data is spread across a
variety of different databases.
 These are managed by a variety of different DBMS software running
on a variety of different operating systems.
 These machines are spread (or distributed) geographically and
connected together by a variety of communication networks
40 Prepared by Aklilu E. @WSU
Advantages of Distributed Database
System
 It provides greater efficiency and better performance.
 A single database (on server) can be shared across
several distinct client (application) systems.
 As data volumes and transaction rates increase, users
can grow the system incrementally.
 It causes less impact on ongoing operations when
adding new locations.
 It provides local autonomy.

Disadvantages of Distributed Database System


 Recovery from failure is more complex in distributed
database systems than in centralized systems.

41 Prepared by Aklilu E. @WSU


1.6 Database Management System
(DBMS)
 Database Management System (DBMS) is a
Software package used for providing
 EFFICIENT, CONVENIENT and SAFE MULTI-USER
(many people/programs accessing same database,
or even same data, simultaneously) storage of and
access to MASSIVE amounts of PERSISTENT (data
outlives programs that operate on it) data.
 A DBMS also provides a systematic method for
creating, updating, storing, retrieving data in a
database.
 DBMS also provides the service of controlling data
access, enforcing data integrity, managing
concurrency control, and recovery.
42 Prepared by Aklilu E. @WSU
Components and Interfaces of
DBMS
 We can identify five major components in the DBMS environment:
hardware, software, data, procedures, and people
 Hardware: - The DBMS and the applications require hardware to run.
 The hardware can range from a single personal computer to a single
mainframe or a network of computers.
 Software: - The software component comprises the DBMS software
itself and the application programs, together with the operating
system, including network software if the DBMS is being used over a
network.
 Data: - the most important component of the DBMS environment
from the end-users‘ point of.
 It acts as a bridge between the machine components and the human
components.
 The database contains both the operational data and the metadata,
 The structure of the database is called the schema.
 Procedures: - the instructions and rules that govern the design and
use of the database.
43 Prepared by Aklilu E. @WSU
Components and Interfaces of
DBMS…
 Some of procedures in DBMS are: -
 Log on to the DBMS.
 Use a particular DBMS facility or application program.
 Start and stop the DBMS.
 Make backup copies of the database.
 Handle hardware or software failures.
 Change the structure of a table, reorganize the database
across multiple disks, improve performance, or archive
data to secondary storage.
 People: Users involved with the system
 There are four distinct types of people/users whom
participate in the DBMS environment and with data
 They are database administrators, database
designers, application developers, and end-users.
44 Prepared by Aklilu E. @WSU
1.6.2 Functions of DBMS
 Data storage, retrieval, and update: DBMS must furnish users with the
ability to store, retrieve, and update data in the database.
 A user-accessible catalog: A DBMS must furnish a catalog in which
descriptions of data items are stored and which is accessible to users.
 Transaction support: A DBMS must furnish a mechanism which will
ensure either that all the updates corresponding to a given transaction
are made or that none of them is made.
 Concurrency control services: A DBMS must furnish a mechanism to
ensure that the database is updated correctly when multiple users are
updating the database concurrently.
 One major objective in using a DBMS is to enable many users to
access shared data concurrently.
 Recovery services: A DBMS must provide a mechanism for recovering
the database in the event that the database is damaged in any way.
 Authorization services: A DBMS must provide a mechanism to ensure
that only authorized users can access the database.

45 Prepared by Aklilu E. @WSU


1.7 Data models and conceptual
models
 A higher-level description of the database schema
is called data-model.
 Data Model: a set of concepts to describe the
structure of a database, and certain constraints
that the database should obey.
 A data model is a description of the way that data
is stored in a database.
 Data model helps to understand the relationship
between entities and to create the most effective
structure to hold data.
 Data Model is a collection of tools or concepts for
describing data, data relationships, data semantics
and data constraints
46 Prepared by Aklilu E. @WSU
Data Models and Conceptual Models…
 The main purpose of Data Model is to represent the
data in an understandable way. Categories of data
models include:
1. Object-based
2. Record-based
3. Physical
1. Record-based Data Models
 Consist of a number of fixed format records.
 Each record type defines a fixed number of fields;
each field is typically of a fixed length.
 Hierarchical Data Model
 Network Data Model
 Relational Data Model
47 Prepared by Aklilu E. @WSU
Record based data model…
 The simplest data model
 Record type is referred to as node or segment
 The top node is the root node
 Nodes are arranged in a hierarchical structure as sort of
upside-down tree
 A parent node can have more than one child node
 A child node can only have one parent node
 The relationship between parent and child is one-to-
many
 Relation is established by creating physical link between
stored records
 To add new record type or relationship, the database
must be redefined and then stored in a new form.
48 Prepared by Aklilu E. @WSU
Advantages and Disadvantages of
Hierarchical data model
 Advantages:
 simple to construct and operate on
 Language is simple; uses constructs like GET, GET
UNIQUE, GET NEXT, GET NEXT WITHIN PARENT etc.
 Disadvantages :
 Navigational and procedural nature of processing
 Database is visualized as a linear arrangement of
records
 Little scope for “query optimization”

49 Prepared by Aklilu E. @WSU


Network Model
 Allows record types to have more than one parent unlike
hierarchical model
 A network data models sees records as set members
 Like hierarchical model network model is a collection of
physically linked records.
 Allow member records to have more than one owner

50 Prepared by Aklilu E. @WSU


Advantages and Disadvantages of Network
data Model
 Advantages
 is able to model complex relationships and
represents semantics of add/delete on the
relationships.
 Can handle most situations for modeling using
record types and relationship types.
 Disadvantages
 Navigational and procedural nature of
processing
 Database contains a complex array of pointers
that thread through a set of records.
 Little scope for automated “query optimization’’
51 Prepared by Aklilu E. @WSU
Relational Data Model
 Can define more flexible and complex relationship
 Viewed as a collection of tables called Relations
 Relation: Two dimensional table
 Stores information or data in the form of tables à rows
and columns
 A row of the table is called tuple equivalent to record
 A column of a table is called attribute equivalent to
fields

52 Prepared by Aklilu E. @WSU


1.7.2 Database Languages
 A database language consists of four parts:
 Data Definition Language (DDL): - used to specify the
database schema
 It allows the DBA or user to describe and name the
entities, attributes, and relationships required for the
application, together with any associated integrity and
security constraints.
 Examples: - Create, Alter, Drop, Rename (Tables, Tuples db)
 Data Manipulation Language (DML): used to both
read and update the database.
 insertion of new data into the database; (INSERT)
 modification of data stored in the database; (UPDATE)
 retrieval of data contained in the database; (SELECT)
 Deletion of data from the database. (DELETE)
53 Prepared by Aklilu E. @WSU
Database Languages…
 Transaction control language (TCL): used to manage
transaction in database and the change made by
data manipulation language statements.
 Transaction: the logical unit of work which consists of
some operations to control some tasks.
 Example: COMMITE: used to permanently save any
transaction into the database.
 ROLLBACK: restore the database to last committee state.
 Data control language (DCL):used to control access
to data stored in database (Authorization)
 GRANT: allows specified users to perform specified tasks

 REVOKE: cancel pervious granted or denied permission

54 Prepared by Aklilu E. @WSU


End of Chapter I
 Any Questions??

55 Prepared by Aklilu E. @WSU


CHAPTER TWO
RELATIONAL DATA MODEL
 2.1 Introduction
 2.2 Properties of Relational Database
 2.3 Building Blocks of the Relational Data
Model
 2.3.1 Entities
 2.3.2 Attributes
 2.3.3 Relationships
 2.3.4 Key Constraints
 2.3.5 Integrity, Referential Integrity and Foreign
Keys Constraints

56 Prepared by Aklilu E. @WSU


Introduction
 Relation: a table with rows and columns
 Attribute: a named column of a relation
 In the relational model, relations are used to hold
information about the objects to be represented in
the database.
 A relation is represented as a two-dimensional table
in which the rows of the table correspond to individual
records and the table columns correspond to
attributes.
 Attributes can appear in any order and the relation
will still be the same relation, and therefore convey
the same meaning.
 Domain: a set of allowable values for one or more
attributes
57 Prepared by Aklilu E. @WSU
Introduction…
 Domains are an extremely powerful feature of the
relational model.
 Every attribute in a relation is defined on a domain.
 Domains may be distinct for each attribute, or two or
more attributes may be defined on the same domain.
 The domain concept is important because it allows the
user to define in a central place the meaning and source
of values that attributes can hold.
 As a result, more information is available to the system
when it undertakes the execution of a relational
operation, and operations that are semantically incorrect
can be avoided.
 Example, for an Attribute Sex, domains could be (Male,
Female, Unknown)
58 Prepared by Aklilu E. @WSU
59 Prepared by Aklilu E. @WSU
Introduction…
 Tuple: a row of a relation
 The elements of a relation are the rows or tuples in the table.
 Tuples can appear in any order and the relation will still be the
same relation, and therefore convey the same meaning.
 The structure of a relation, together with a specification of the
domains and any other restrictions on possible values, is
called its intension, which is usually fixed unless the meaning
of a relation is changed to include additional attributes.
 The tuples are called the extension (or state) of a relation,
which changes over time.
 Degree: the degree of a relation is the number of attributes it
contains Unary relation, Binary relation, Ternary relation, N-ary
relation.

60 Prepared by Aklilu E. @WSU


Introduction…
 A relation with only one attribute is called a
unary relation or one-tuple.
 A relation with two attributes is called binary,
 A relation with three attributes is called
ternary,
 after that the term n-ary is usually used.
 The degree of a relation is a property of the
intension of the relation

61 Prepared by Aklilu E. @WSU


Introduction…
 Cardinality: of a relation is the number of tuples the
relation has By contrast, the number of tuples is called the
cardinality of the relation and this changes as tuples are
added or deleted. i.e extension
 The cardinality is a property of the extension of the relation
and is determined from the particular instance of the relation
at any given moment.
 Relational Database: a collection of normalized relations
with distinct relation names.
 A relational database consists of relations that are
appropriately structured.
 Relation Schema: a named relation defined by a set of
attribute-domain name pair
 Let A1, A2………..An be attributes with domain D1, D2 ………,Dn.
 Then the sets {A1:D1, A2:D2… An:Dn} is a Relation Schema.
62 Prepared by Aklilu E. @WSU
 A relation R, defined by a relation schema S, is a
set of mappings from attribute names to their
corresponding domains.
 Thus a relation is a set of n- tuples of the form
(A1:d1, A2:d2 ,…, An:dn) where d1 є D1, d2 є D2,
…….. dn є Dn,
 Relational Database schema: a set of relation
schema each with distinct names.
 Suppose R1, R2,……, Rn is the set of relation
schema in a relational database then the
relational database schema (R) can be stated as:
R={ R1 , R2 ,……., Rn}.

63 Prepared by Aklilu E. @WSU


2.1 Properties of Relational Databases
 A relation has a name that is distinct from all other
relation names in the relational schema.
 Each tuple in a relation must be unique
 All tables are LOGICAL ENTITIES
 Each cell of a relation contains exactly one atomic
(single) value.
 Each column (field or attribute) has a distinct name.
 The values of an attribute are all from the same domain.
 A table is either a BASE TABLES (Named Relations) or
VIEWS (Unnamed Relations)
 Only Base Tables are physically stored
 VIEWS are derived from BASE TABLES with SQL
statements like: [SELECT .. FROM .. WHERE .. ORDER BY]
64 Prepared by Aklilu E. @WSU
2.1 Properties of Relational
Databases…
 Relational database is the collection of tables
 Order of rows theoretically ( but practically
has impact on performance) and columns is
immaterial
 Entries with repeating groups are said to be
un-normalized.
 All values in a column represent the same
attribute and have the same data format

65 Prepared by Aklilu E. @WSU


2.2 Building Blocks of the Relational
Data Model
 The building blocks of the relational data
model are:
 Entities: real world physical or logical object
 Attributes: properties used to describe each
Entity or real world object.
 Relationship: the association between Entities
 Constraints: rules that should be obeyed while
manipulating the data.

66 Prepared by Aklilu E. @WSU


2.2.1 ENTITIES
 The Entities are persons, places; things etc. which the
organization has to deal with Relations can also describe
relationships.
 The name given to an entity should always be a singular noun
descriptive of each item to be stored in it.
 Example: student NOTstudents.
 Every relation has a schema, which describes the columns, or
fields the relation itself corresponds to our familiar notion of a
table:
 A relation is a collection of tuples, each of which contains
values for a fixed number of attributes
 Existence Dependency: the dependence of an entity on the
existence of one or more entities.
 Weak entity : an entity that cannot exist without the entity
with which it has a relationship – it is indicated by a double
rectangle
67 Prepared by Aklilu E. @WSU
2.2.2 The ATTRIBUTES
 The attributes are the items of information which
characterize and describe these entities.
 The analysis must of course identify those which
are actually relevant to the proposed application.
 Attribute name (be explanatory words or phrases)
Types of Attributes
 1. Simple (atomic) Vs Composite attributes
 Simple: contains a single value (not divided into
sub parts)
 Example: Age, gender
 Composite: Divided into sub parts (composed of
other attributes) Example: Name, address
68 Prepared by Aklilu E. @WSU
Types of Attributes

 Single-valued Vs multi-valued attributes


 Single-valued: have only single value(the value may change but has
only one value at one time)
 Example: Name, Sex, Id. No. color_of_eyes
 Multi-Valued: have more than one value
 Example: Address, dependent-name
 Person may have several college degrees
 Stored vs. Derived Attribute
 Stored : not possible to derive or compute
 Example: Name, Address
 Derived: The value may be derived (computed) from the values of other
attributes.
 Example: Age (current year – year of birth)
 Null Values
 NULL applies to attributes which are not applicable or which do not have
values.
 You may enter the value NA (meaning not applicable) • Value of a key
attribute
69 cannot be null. Prepared by Aklilu E. @WSU
Entity versus Attributes
 When designing the conceptual specification of
the database, one should pay attention to the
distinction between an Entity and an Attribute.
2.2.3 The RELATIONSHIPS
 The Relationships between entities which exist
and must be taken into account when
processing information.
 In any business processing one object may be
associated with another object due to some
event.
 Such kind of association is what we call a
RELATIONSHIP between entity objects.
70 Prepared by Aklilu E. @WSU
The RELATIONSHIPS…
 One external event or process may affect several related
entities.
 Related entities require setting of LINKS from one part of
the database to another.
 A relationship should be named by a word or phrase
which explains its function
 Role names are different from the names of entities
forming the relationship: one entity may take on many
roles, the same role may be played by different entities
 For each RELATIONSHIP, one can talk about the Number
of Entities and the Number of Tuples participating in the
association.
 These two concepts are called DEGREE and
CARDINALITY of a relationship respectively.
71 Prepared by Aklilu E. @WSU
Degree of a Relationship
 An important point about a relationship is how many
entities participate in it.
 The number of entities participating in a relationship is
called the DEGREE of the relationship.
 Among the Degrees of relationship, the following are the
basic:
 UNARY/RECURSIVE RELATIONSHIP: Tuples/records of a
Single entity are related withy each other.
 BINARY RELATIONSHIPS: Tuples/records of two entities
are associated in a relationship
 TERNARY RELATIONSHIP: Tuples/records of three
different entities are associated
 N-ARY RELATIONSHIP: Tuples from arbitrary number of
entity sets are participating in a relationship.
72 Prepared by Aklilu E. @WSU
2.2.3.2 Cardinality of a Relationship
 The number of instances participating or associated
with a single instance from an entity in a relationship
is called the CARDINALITY of the relationship.
 The major cardinalities of a relationship are:
 ONE-TO-ONE: one tuple is associated with only one
other tuple.
 Example: Building – Location as a single building will
be located in a single location and as a single
location will only accommodate a single Building.
 ONE-TO-MANY, one tuple can be associated with
many other tuples, but not the reverse.
 Example: Department-Student as one department
can have multiple students.
73 Prepared by Aklilu E. @WSU
2.2.3.2 Cardinality of a
Relationship…
 MANY-TO-ONE, many tuples are associated with one
tuple but not the reverse.
 Example: Employee – Department: as many
employees belong to a single department.
 MANY-TO-MANY: one tuple is associated with many
other tuples and from the other side, with a different
role name one tuple will be associated with many
tuples
 Example: Student – Course as a student can take
many courses and a single course can be attended
by many students.
 However, the degree and cardinality of a relation are
different from degree and cardinality of a relationship

74 Prepared by Aklilu E. @WSU


2.2.4 Key constraints
 If tuples are need to be unique in the database, and then
we need to make each tuple distinct.
 To do this we need to have relational keys that uniquely
identify each record.
 Super Key: an attribute/set of attributes that uniquely
identify a tuple within a relation.
 Candidate Key: a super key such that no proper subset of
that collection is a Super Key within the relation.
 A candidate key has two properties:
 1. Uniqueness
 2. Irreducibility
 If a super key is having only one attribute, it is
automatically a Candidate key.
 If a candidate key consists of more than one attribute it is
called Composite Key.
75 Prepared by Aklilu E. @WSU
2.2.4 Key constraints…
 3. Primary Key: the candidate key that is selected to identify
tuples uniquely within the relation.
 The entire set of attributes in a relation can be considered as a
primary case in a worst case.
 4. Foreign Key: an attribute, or set of attributes, within one
relation that matches the candidate key of some relation.
 It is a link between different relations to create a view or an
unnamed relation
 The entity integrity constraint states that no primary key value
can be NULL.
 This is because the primary key value is used to identify
individual tuples in a relation.
 Having NULL values for the primary key implies that we cannot
identify some tuples.
 Key constraints and entity integrity constraints are specified on
individual relations.
76 Prepared by Aklilu E. @WSU
2.2.5 Integrity, Referential Integrity
and Foreign Keys Constraints
 The referential integrity constraint is specified between two
relations and is used to maintain the consistency among tuples in
the two relations.
 Informally, the referential integrity constraint states that a tuple in
one relation that refers to another relation must refer to an existing
tuple in that relation.
 For example, the attribute Dept_Num of EMPLOYEE gives the
department number for which each employee works; hence, its
value in every EMPLOYEE tuple must match the Dept_Num
value/attribute of some tuple in the DEPARTMENT relation.
 To define referential integrity more formally, first we define the
concept of a foreign key.
 The conditions for a foreign key, given below, specify a referential
integrity constraint between the two relation schemas R1 and R2.
 A set of attributes FK (foreign key) in relation schema R1 is a foreign
key of R1 that references relation R2 if it satisfies the following
rules:
77 Prepared by Aklilu E. @WSU
2.2.5 Integrity, Referential Integrity
and Foreign Keys Constraints…
 Rule 1: The attributes in FK have the same domain(s) as the
primary key attributes PK of R2; the attributes FK are said to
reference or refer to the relation R2.
 Rule 2: A value of FK in a tuple t1 of the current state r1(R1)
either occurs as a value of PK for some tuple t2 in the current state
r2(R2) or is NULL.
 In the former case, we have t1[FK] = t2[PK], and we say that the
tuple t1 references or refers to the tuple t2.
 In this definition, R1 is called the referencing relation and R2 is the
referenced relation.
 If these two conditions hold, a referential integrity constraint from
R1 to R2 is said to hold.
 In a database of many relations, there are usually many referential
integrity constraints.
 Referential integrity constraints typically arise from the
relationships among the entities represented by the relation
schemas.
78 Prepared by Aklilu E. @WSU
2.2.5 Integrity, Referential Integrity
and Foreign Keys Constraints…
 All integrity constraints should be specified on the relational database
schema (i.e., defined as part of its definition) if we want to enforce these
constraints on the data- base states.
 Hence, the DDL includes provisions for specifying the various types of
constraints so that the DBMS can automatically enforce them.
 Most relational DBMSs support key, entity integrity, and referential
integrity constraints.
 These constraints are specified as a part of data definition in the DDL.
 The following constraints are specified as a part of data definition using
DDL:
 Domain Integrity: No value of the attribute should be beyond the
allowable limits
 Entity Integrity: In a base relation, no attribute of a Primary Key can
assume a value of NULL
 Referential Integrity: If a Foreign Key exists in a relation, either the
Foreign Key value must match a Candidate Key value in its home relation
or the Foreign Key value must be NULL
 Enterprise Integrity: Additional rules specified by the users or database
administrators of a databasePrepared
79
are incorporated.
by Aklilu E. @WSU
End of Chapter II
 Any Questions??

80 Prepared by Aklilu E. @WSU


CHAPTER THREE
Conceptual Database Design- E-R Modeling
 3. 1 Database Development Life
 3.2 Basic concepts of E-R model
 3.3 Developing an E-R Diagram
 3.4 Graphical Representations in Entity Relationship
Diagram
 3.4.1 Conceptual ER diagram symbols
 3.4.1.1 Entity
 3.4.1.2 Attributes
 3.41.3 Relationships
 3.4.1.4 Degree of Relationships
 3.4.1.5 Binary Relationship and Cardinality
 3.4.1.3 Participation of an Entity set in a Relationship Set
 3.5 Problem with E-R models
81 Prepared by Aklilu E. @WSU
Database Development Life Cycle
 There are several steps in designing a database system.
 The major steps in database design are;
 1. Planning: that is identifying information gap in an organization
and propose a database solution to solve the problem.
 2. Analysis: that concentrates more on fact finding about the
problem or the opportunity.
 Feasibility analysis, requirement determination and structuring,
and selection of best design method are also performed at this
phase.
 3. Design: in database development more emphasis is given to
this phase.
 The phase is further divided into three sub-phases.
 1. Conceptual Design: concise/brief description of the data, data
type, relationship between data and constraints on the data.
 There is no implementation or physical detail consideration.
 Used to elicit/draw and structure all information requirements
82 Prepared by Aklilu E. @WSU
Database Development Life
Cycle…
 2. Logical Design: a higher level conceptual abstraction
with selected specific data model to implement the data
structure.
 It is particular DBMS independent and with no other physical
considerations.
 3. Physical Design: physical implementation of the logical
design of the database with respect to internal storage and
file structure of the database for the selected DBMS.
 To develop all technology and organizational specification.
 4. Implementation: the testing and deployment of the
designed database for use.
 5. Operation and Support: administering and
maintaining the operation of the database system and
providing support to users.
 Tuning/changing the database operations for best
performance.
83 Prepared by Aklilu E. @WSU
3.1.1 Conceptual Database Design
 Conceptual design revolves around
discovering and analyzing organizational and
user data requirements
 The important activities are to identify
 Entities
 Attributes
 Relationships
 Constraints
 And based on these identified components
then develop the ER model using ER diagrams

84 Prepared by Aklilu E. @WSU


3.2 Basic concepts of E-R model
 Entity-Relationship modeling is used to represent conceptual view of
the database
 The main components of ER Modeling are:
Entities
 Corresponds to entire table, not row
 Represented by Rectangle

Attributes
 Represents the property used to describe an entity or a
relationship
 Represented by Oval

Relationships
 Represents the association that exist between entities
 Represented by Diamond

Constraints
 Represent the constraint in the data
 Cardinality and Participation Constraints
85 Prepared by Aklilu E. @WSU
3.2 Basic concepts of E-R model…
 Before working on the conceptual design of the
database, one has to know and answer the
following basic questions.
 What are the entities and relationships in the
enterprise?
 What information about these entities and
relationships should we store in the database?
 What are the integrity constraints that hold?
Constraints on each data with respect to update,
retrieval and store.
 Represent this information pictorially in ER
diagrams, then map ER diagram into a relational
schema.
86 Prepared by Aklilu E. @WSU
3.3 Developing an E-R Diagram
 Designing conceptual model for the database is not a one
linear process but an iterative activity where the design is
refined again and again.
 To identify the entities, attributes, relationships, and
constraints on the data, there are different set of methods
used during the analysis phase.
 These include information gathered by:
 Interviewing end users individually and in a group
 Questionnaire survey
 Direct observation
 Examining different documents Analysis of requirements
gathered:
 Nouns à prospective/potential entities
 Adjectives à prospective/potential attributes
 Verbs/verb phrases à prospective/potential relationships
87 Prepared by Aklilu E. @WSU
3.3 Developing an E-R Diagram….
 The basic E-R model is graphically depicted and
presented for review.
 The process is repeated until the end users and designers
agree that the E-R diagram is a fair representation of the
organizations activities and functions.
 Checking for Redundant Relationships in the ER Diagram
Relationships between entities indicate access from one
entity to another
 It is therefore possible to access one entity occurrence
from another entity occurrence even if there are other
entities and relationships that separate them
 This is often referred to as Navigation’ of the ER diagram.
 The last phase in ER modeling is validating an ER Model
against requirement of the user

88 Prepared by Aklilu E. @WSU


Entity Types

89 Prepared by Aklilu E. @WSU


Examples of Entities

90 Prepared by Aklilu E. @WSU


3.4.1.2 Attributes
 Attributes are the properties of entities.
 Attributes are represented by means of
ellipses.
 An attribute is a property, trait, or
characteristic of an entity, relationship, or
another attribute.
 Attributes are represented by OVALS and are
connected to the entity by a line.

91 Prepared by Aklilu E. @WSU


Types of Attributes
Multivalued attribute:
 Multivalued attributes are those that are can
take on more than one value.
 These attributes are depicted by double
ellipse.
 It can be represented by the following symbol

92 Prepared by Aklilu E. @WSU


Attribute Types…

Key attribute uniquely identifies an entity from an entity set.


The text of Key attribute is underlined as shown in the
above figure, i.e Roll_No
Derived Attribute:
 Derived attributes are those which are derived based on
other attributes, for example, age can be derived from
date of birth.
 To represent a derived attribute, another dotted ellipse is
created
93 Prepared by Aklilu E. @WSU
Derived Attributes
 Composite Attribute: - An attribute that is
the combination of other attributes; Example,
in student entity, student address is a
composite attribute as it can have another
attributes such as pin-code, state, country.

94 Prepared by Aklilu E. @WSU


Relationships
 Relationships are represented by DIAMOND shaped
symbols
 The associations among entity is called relationship

Examples
 An employee works at department
 Student enrolls in course
 Here, works at & Enrolls are relationships
 Names of relationships are written inside the
diamond box.
 All the entities (rectangles) participating in a
relationship are connected with relationships by a
line.
95 Prepared by Aklilu E. @WSU
Examples of Relationships

96 Prepared by Aklilu E. @WSU


97 Prepared by Aklilu E. @WSU
Degree of Relationship
 The number of participating entities in a relationship defines the
degree of the relationship.
 There are three categories of degree of relationship:
 1. Binary = degree 2
 2. Ternary = degree 3
 3. n-ary = n degree
 3.4.1.5 Binary Relationship and Cardinality
 A relationship where two entities are participating is called a
binary relationship.
 Cardinality is the number of instance of an entity from a relation
that can be associated with the relation.
 Cardinality refers to the maximum number of times an instance in
one entity can relate to instances of another entity.
 Ordinality, on the other hand, is the minimum number of times an
instance in one entity can be associated with an instance in the
related entity.
98 Prepared by Aklilu E. @WSU
Degree of Relationships…
 1. One-to-one: When only one instance of
an entity is associated with the relationship, it
is marked as ‘1:1’.
 The following image reflects that only one
instance of each entity should be associated
with the relationship.
 It depicts one-to-one relationship

99 Prepared by Aklilu E. @WSU


100 Prepared by Aklilu E. @WSU
Participation of an Entity set in a
Relationship Set
 Participation constraints of a relationship is
involved in identifying and setting the
mandatory or optional features of an entity
occurrence to talk a role in a relationship.
 There are two types of participation so called
Total Participation and Partial participations.
 Participation of DEPARTMENT in Manages
relationship with EMPLOYEE is total since
every department should have a manager.

101 Prepared by Aklilu E. @WSU


102 Prepared by Aklilu E. @WSU
3.5 Problem with E-R models
 The Entity-Relationship Model is a conceptual data model
that views the real world as consisting of entities and
relationships.
 The model visually represents these concepts by the Entity-
Relationship diagram.
 The basic constructs of the ER model are entities,
relationships, and attributes.
 Entities are concepts, real or abstract, about which
information is collected.
 Relationships are associations between the entities.
 Attributes are properties which describe the entities.
 While designing the ER model one could face a problem on
the design which is called a connection traps.
 Connection traps are problems arising from misinterpreting
certain relationships
103 Prepared by Aklilu E. @WSU
3.6 Enhanced E-R Models (EERMs)
 EER is a high level data model, that
incorporates the extensions to the original ER-
model.
 It is Object Oriented extensions to ER model

Reading Assignment

104 Prepared by Aklilu E. @WSU


End of Chapter III
 Any Questions??

105 Prepared by Aklilu E. @WSU


CHAPTER FOUR
4. Logical Database Design
 Introduction
 The whole purpose of the data base design is to create an
accurate representation of the data, the relationship between
the data and the business constraints related to that
organization.
 Therefore, one can use one or more technique to design a data
base; the E-R model is one of it.
 Normalization also is another technique to design database with
a different emphasis to the database design
 It defines the structure of a database with a specific data model.
 Logical design is the process of constructing a model of the
information used in an enterprise based on a specific data
model (e.g. relational, hierarchical or network or object), but
independent of a particular DBMS and other physical
considerations.

106 Prepared by Aklilu E. @WSU


Introduction…
 Logical database design is the process of deciding
how to arrange the attributes of the entities in a given
business environment into database structures, such
as the tables of a relational database.
 The goal of logical database design is to create well-
structured tables that properly reflect the company’s
business environment.
 The tables will be able to store data about the
company’s entities in a non-redundant manner
 Foreign keys will be placed in the tables so that all the
relationships among the entities will be supported.
 Physical database design is the process of modifying
the logical database design to improve performance.

107 Prepared by Aklilu E. @WSU


Normalization
 The focus in logical database design is the
Normalization Process; It is;
 Collection of Rules (Tests) to be applied on relations
to obtain the minimal, non-redundant set or
attributes.
 Discover new entities in the process
 Revise attributes based on the rules and the
discovered Entities
 Works by examining the relationship between
attributes known as functional dependency.
 The purpose of normalization is to find the
suitable set of relations that supports the data
requirements of an enterprise.
108 Prepared by Aklilu E. @WSU
Normalization…
 Characteristics of a suitable set of relations;
 Minimal number of attributes to support the data
requirements of the enterprise
 Attributes with close logical relationship (functional
dependency) should be placed in the same relation.
 Minimal redundancy with each attribute represented
only once with the exception of the attributes which
form the whole or part of the foreign key, which are
used for joining of related tables.
 The first step before applying the rules in
relational data model is converting the
conceptual design to a form suitable for
relational logical model, which is in a form of
tables.
109 Prepared by Aklilu E. @WSU
Converting ER Diagram to
Relational Tables
 Three basic rules to convert ER into tables or
relations:
 Rule 1: Entity Names will automatically be table
names
 Rule 2: Mapping of attributes: attributes will be
columns of the respective tables.
 Atomic or single-valued or derived or stored
attributes will be columns
 Composite attributes: the parent attribute will be ignored
and the decomposed attributes (child attributes) will be
columns of the table.
 Multi-valued attributes: will be mapped to a new table
where the primary key of the main table will be posted
for cross referencing.
110 Prepared by Aklilu E. @WSU
Converting ER Diagram to Relational Tables…
 Rule 3: Relationships: relationship will be mapped by using a
foreign key attribute.
 Foreign key is a primary or candidate key of one relation used to
create association between tables.
 For a relationship with One-to-One Cardinality: post the primary or
candidate key of one of the table into the other as a foreign key.
 E.g.: for a relationship between Employee and Department where
employee manages a department, the cardinality is one-to-one as
one employee will manage only one department and one
department will have one manager. here the PK of the Employee
can be posted to the Department or the PK of the Department can
be posted to the Employee.
 But the Employee is having partial participation on the
relationship “Manages” as not all employees are managers of
departments.
 Thus, even though both way is possible, it is recommended to
post the primary key of the employee to the Department table as
a foreign key.
111 Prepared by Aklilu E. @WSU
Converting ER Diagram to Relational Tables…
 For a relationship with One-to-Many Cardinality:
 Post the primary key or candidate key from the one side
as a foreign key attribute to the many side.
 E.g; For a relationship called Belongs To between
Employee (Many) and Department (One) the primary or
candidate key of the one side which is Department
should be posted to the many side which is Employee
table.
 For a relationship with Many-to-Many Cardinality:
 For relationships having many to many cardinality, one
has to create a new table (which is the associative entity)
and post primary key or candidate key from the
participant entities as foreign key attributes in the new
table along with some additional attributes (if applicable).
 The same approach should be used for relationships with
degree greater than binary.
112 Prepared by Aklilu E. @WSU
Converting ER Diagram to
Relational Tables…
 For a relationship having Associative Entity
property:
 In cases where the relationship has its own attributes
(associative entity), one has to create a new table for the
associative entity and post primary key or candidate key
from the participating entities/original table as foreign key
attributes in the new table/associative entity.
 The following ER has been designed to represent the
requirement of an organization to capture Employee
Department and Project information.
 Employee works for department where an employee might
be assigned to manage a department.
 Employees might participate on different projects within
the organization.
 An employee might as well be assigned to lead a project
113 Prepared by Aklilu E. @WSU
where the starting and ending date of his/her project
114 Prepared by Aklilu E. @WSU
115 Prepared by Aklilu E. @WSU
116 Prepared by Aklilu E. @WSU
117 Prepared by Aklilu E. @WSU
Cont.…
 After converting the ER diagram in to table
forms, the next phase is implementing the
process of normalization, which is a collection
of rules each table should satisfy.

118 Prepared by Aklilu E. @WSU


4.2 Normalization
 A relational database is merely a collection of data,
organized in a particular manner.
 As the father of the relational database approach, Codd
created a series of rules (tests) called normal forms that
help define that organization
 One of the best ways to determine what information
should be stored in a database is to clarify what questions
will be asked of it and what data would be included in the
answers.
 Database normalization is a series of steps followed to
obtain a database design that allows for consistent storage
and efficient access of data in a relational database.
 These steps reduce data redundancy and the risk of data
becoming inconsistent.

119 Prepared by Aklilu E. @WSU


Normalization…
 It is the process of identifying the logical associations between
data items and designing a database that will represent such
associations but without suffering the update anomalies which
are;
 Insertion Anomalies
 Deletion Anomalies
 Modification Anomalies
 Normalization may reduce system performance since data will be
cross referenced from many tables.
 Thus denormalization is sometimes used to improve
performance, at the cost of reduced consistency guarantees.
 Normalization normally is considered good if it is lossless
decomposition.
 All the normalization rules will eventually remove the update
anomalies that may exist during data manipulation after the
implementation.
 The update anomalies are; the type of problems that could occur
in insufficiently normalized table is called update anomalies
120 Prepared by Aklilu E. @WSU
which includes;
Normalization…
Insertion anomalies
 An “insertion anomaly” is a failure to place
information about a new database entry into all the
places in the database where information about that
new entry needs to be stored.
 Additionally, we may have difficulty to insert some
data.
 In a properly normalized database, information about
a new entry needs to be inserted into only one place
in the database; in an inadequately normalized
database, information about a new entry may need
to be inserted into more than one place and, human
fallibility being what it is, some of the needed
additional insertions may be missed.
121 Prepared by Aklilu E. @WSU
Normalization…
Deletion anomalies
 “deletion anomaly” is a failure to remove information about an
existing database entry when it is time to remove that entry.
 Additionally, deletion of one data may result in lose of other
information.
 In a properly normalized database, information about an old, to-
begotten-rid-of entry needs to be deleted from only one place in
the database; in an inadequately normalized database, information
about that old entry may need to be deleted from more than one
place, and, human fallibility being what it is, some of the needed
additional deletions may be missed.
Modification anomalies
 modification of a database involves changing some value of the
attribute of a table.
 In a properly normalized database table, what ever information is
modified by the user, the change will be effected and used
accordingly.
122 Prepared by Aklilu E. @WSU
Normalization…
 In order to avoid the update anomalies we in a given
table, the solution is to decompose it to smaller tables
based on the rule of normalization.
 However, the decomposition has two important
properties
 1. The Lossless-join property insures that any instance of
the original relation can be identified from the instances
of the smaller relations.
 11.The Dependency preservation property implies that
constraint on the original dependency can be maintained
by enforcing some constraints on the smaller relations.
 i.e. we don‘t have to perform Join operation to check
whether a constraint on the original relation is violated
or not.

123 Prepared by Aklilu E. @WSU


Group Assignment 15%
 Define and Explain the Following Concepts in
detail with Examples for each.
1. Normalization
1.1 First Normal Form
1.2 Second Normal Form
1.3 Third Normal Form
From Chapter Six
4. Relational Algebra
5. Relational Calculus
Submission 27/09/2015 E.C

124 Prepared by Aklilu E. @WSU


CHAPTER FIVE
5. Physical Database Design
 5.1 Conceptual, Logical, and Physical
Data Models
 5.2 Physical Database Design Process
 5.1.1. Overview of the Physical Database
Design Methodology

125 Prepared by Aklilu E. @WSU


5.1 Conceptual, Logical, and
Physical Data Models
 You begin with a summary-level business data model
that‘s most often used on strategic data projects.
 It typically describes an entire enterprise/Organization,
which allows you to understand at a high level the
different entities in your data and how they relate to
one another.
 Due to its highly abstract nature, it may be referred to
as a conceptual model.
 Common characteristics of a conceptual data model:
 A conceptual data model identifies important entities
and the high-level relationships among them.
 This means no attribute or primary key is specified.
 Moreover, complexity increases as you expand from a
conceptual data model.
126 Prepared by Aklilu E. @WSU
5.1 Conceptual, Logical, and
Physical Data Models…
 A logical data model, otherwise known as a fully attributed
data model, allows you to understand the details of your data
without worrying about how the data will be implemented in
the database.
 Additionally, a logical data model will normally be derived
from and or linked back to objects in a conceptual data model.
 It is independent of DBMS, technology, data storage or
organizational constraints.
Common characteristics of a logical data model:
 Unlike the conceptual model, a logical model includes all
entities and relationships among them.
 Additionally, all attributes, the primary key, and foreign keys
(keys identifying the relationship between different entities)
are specified.
 As a result, normalization occurs at this level.

127 Prepared by Aklilu E. @WSU


5.1 Conceptual, Logical, and
Physical Data Models…
 The steps for designing the logical data model are as
follows:
 First, specify primary keys for all entities.
 Then find the relationships between different entities.
 Find all attributes for each entity.
 Lastly, resolve many-to-many relationships.
 Finally, the physical data model will show you exactly how to
implement your data model in the database of choice.
 This model shows all table structures, including column
name, column data type, column constraints, primary
key, foreign key, and relationships between tables.
 Correspondingly, the target implementation technology
may be a relational DBMS, an XML document, a
spreadsheet, or any other data implementation option
128 Prepared by Aklilu E. @WSU
129 Prepared by Aklilu E. @WSU
5.2 Physical Database Design
Process
 Physical database design is the process of transforming
logical data models into physical data models.
 Physical database design is the process of transforming a
data model into the physical data structure of a particular
database management system (DBMS).
 Normally, Physical Design is accomplished in multiple
steps, which include expanding a business model into a
fully attributed model (FAM) and then transforming the fully
attributed model into a physical design model.
 Physical database design is the process of producing a
description of the implementation of the database on
secondary storage;
 It describes the base relations, file organizations, and
indexes used to achieve efficient access to the data, and
any associated integrity constraints and security measures.
130 Prepared by Aklilu E. @WSU
5.2 Physical Database Design
Process…
 The physical database design phase allows the designer to make
decisions on how the database is to be implemented.
 Therefore, physical design is tailored to a specific DBMS.
 There is feedback between physical and logical design, because
decisions taken during physical design for improving performance may
affect the logical data model.
 Database design process in database design methodology is divided
into three main phases: conceptual, logical, and physical database
design.
 The logical database design is largely independent of implementation
details, such as the specific functionality of the target DBMS and
application programs, but is dependent on the target data model.
 The output of this process is a logical data model consisting of an
ER/relation diagram, relational schema, and supporting documentation
that describes this model, such as a data dictionary.
 Together, these represent the sources of information for the physical
design process and provide the physical database designer with a
vehicle for making adjustments that are so important to an efficient
database design.
131 Prepared by Aklilu E. @WSU
5.2 Physical Database Design
Process…
 The physical database designer must know how the
computer system hosting the DBMS operates and must
be fully aware of the functionality of the target DBMS.
 As the functionality provided by current systems varies
widely, physical design must be tailored to a specific
DBMS.
 However, physical database design is not an isolated
activity there is often feedback between physical,
logical, and application design.
 For example, decisions taken during physical design
for improving performance, such as merging relations
together, might affect the structure of the logical data
model, which will have an associated effect on the
application design.
132 Prepared by Aklilu E. @WSU
5.2 Physical Database Design
Process…
 Physical database design translates the logical data model
into a set of SQL statements that define the database.
 For relational database systems, it is relatively easy to
translate from a logical data model into a physical
database.
Overview of the Physical Database Design Methodology
 Choosing a physical data structure for the data constructs
in the data model.
 Optionally choosing DBMS options for the existence
constraints in the data model.
 Does not change the business meaning of the data.
 Should not denormalize the data unless required for
performance.
133 Prepared by Aklilu E. @WSU
End of Chapter V
 Any Questions??

134 Prepared by Aklilu E. @WSU


Chapter Six
Query Languages
Assignments
 6.1 Relational Algebra
 6.2 Relational Calculus
Laboratory Classes
 6.3 Structured Query Language (SQL)
 6.3.1 Data Definition Languages (DDL)
 6.3.2 Data Manipulation Languages (DML)
 6.3.3 Data Control Languages (DCL)
 6.3.4 Transaction Control Languages (TCL)

135 Prepared by Aklilu E. @WSU


Chapter Seven
Advanced Database Concepts
 Integrity and Security
 Levels of Security Measures
 Distributed Database Systems
 Data Warehousing and Data Mining

136 Prepared by Aklilu E. @WSU


Integrity and Security
 A database represents an essential company resource that should
be properly secured using appropriate controls.
 Multi-user database system must provide a database security and
authorization subsystem to enforce limits on individual and group
access rights and privileges.
 Database security and integrity is about protecting the database
from being inconsistent and being disrupted.
 We can also call it database misuse.
 Database security encompasses hardware, software, people and
data.
 Database misuse could be Intentional or accidental, where
accidental misuse is easier to cope with than intentional misuse.
 Accidental inconsistency could occur due to:
 System crash during transaction processing
 Anomalies/Irregularities due to concurrent access
 Anomalies due to redundancy
 Logical errors
137 Prepared by Aklilu E. @WSU
Integrity and Security…
 Likewise, even though there are various threats that could be
categorized in this group, intentional misuse could be:
 Unauthorized reading of data
 Unauthorized modification of data or
 Unauthorized destruction of data
 Most systems implement good Database Integrity to protect
the system from accidental misuse while there are many
computer based measures to protect the system from
intentional misuse, which is termed as Database Security
measures.
 Database security is considered in relation to the following
situations:
 Theft and fraud
 Loss of confidentiality (secrecy)
 Loss of privacy
 Loss of integrity

138
Loss of availability Prepared by Aklilu E. @WSU
Security Issues and general
considerations
 Legal, ethical and social issues regarding the right to access
information
 Physical control
 Policy issues regarding privacy of individual level at enterprise
and national level
 Operational consideration on the techniques used (password,
etc)
 System level security including operating system and hardware
control Security levels and security policies in enterprise level
 Threat is any situation or event, whether intentional or
accidental, that may adversely affect a system and
consequently the organization.
 A threat may be caused by a situation or event involving a
person, action, or circumstance that is likely to bring harm to an
organization.

139 Prepared by Aklilu E. @WSU


Security Issues and general
considerations…
 The harm to an organization may be tangible or intangible:
 Tangible – loss of hardware, software, or data
 Intangible – loss of credibility or client confidence Examples of
threats:
 Unauthorized amendment/modification or copying of data
 Program alteration
 Inadequate policies and procedures that allow a mix of
confidential and normal out put
 Wiretapping/bugging i.e, making database to be full of errors
 Illegal entry by hacker
 Blackmail/corrupt
 Creating trapdoor/ putting open-door to system
 Theft of data, programs, and equipment
 Failure of security mechanisms, giving greater access than
normal
140 Prepared by Aklilu E. @WSU
Levels of Security Measures
 Security measures can be implemented at several levels and for
different components of the system.
 These levels are:
 Physical Level: concerned with securing the site containing the
computer system should be physically secured.
 The backup systems should also be physically protected from access
except for authorized users.
 Human Level: concerned with authorization of database users for
access the content at different levels and privileges.
 Operating System: concerned with the weakness and strength of the
operating system security on data files.
 Weakness may serve as a means of unauthorized access to the
database.
 This also includes protection of data in primary and secondary memory
from unauthorized access.
 Database System: concerned with data access limit enforced by the
database system.
 Access limit like password, isolated transaction and etc.
141 Prepared by Aklilu E. @WSU
Countermeasures: Computer Based
Controls
 The following are computer-based security
controls for a multi-user environment: which are
related to Authorization:
 Read Authorization: the user with this privilege is
allowed only to read the content of the data object.
 Insert Authorization: the user with this privilege is
allowed only to insert new records or items to the
data object.
 Update Authorization: users with this privilege are
allowed to modify content of attributes but are not
authorized to delete the records.
 Delete Authorization: users with this privilege are
only allowed to delete a record and not anything
142 Prepared by Aklilu E. @WSU
The major responsibilities of DBA in
relation to authorization of users are:
 Account Creation: involves creating different accounts for
different USERS as well as USER GROUPS.
 Security Level Assignment: involves in assigning different
users at different categories of access levels.
 Privilege Grant: involves giving different levels of privileges
for different users and user groups.
 Privilege Revocation: involves denying or canceling
previously granted privileges for users due to various
reasons.
 Account Deletion: involves in deleting an existing account of
users or user groups. It is similar with denying all privileges
of users on the database.
 Encryption: - is the process of encoding the data by a
special algorithm that renders the data unreadable by any
program without the decryption key.

143 Prepared by Aklilu E. @WSU


Distributed Database Systems
 A distributed database (DDB) is a collection of
multiple, logically interrelated databases
distributed over a computer network.
 A distributed database management system
(DDBMS) is the software that manages the
DDB and provides an access mechanism that
makes this distribution transparent to the
users.
 Distributed database system (DDBS) = DDB +
DDBMS

144 Prepared by Aklilu E. @WSU


DDBS

145 Prepared by Aklilu E. @WSU


Distributed DBMS Promises
 Transparent management of distributed,
fragmented, and replicated data
 Improved reliability/availability through
distributed transactions
 Improved performance
 Easier and more economical system
expansion

146 Prepared by Aklilu E. @WSU


Data Warehousing and Data Mining
 Data Warehousing: - The process of
establishing a data warehouse:
 Data warehouse is a repository which is organized
for decision support and stores historical data
rather than operational data.
 Online transaction processing (OLTP) operations are
performed with data warehousing.
 Characteristics of data warehouse
 Subject-oriented,
 Integrated,
 Time-variant,
 Nonvolatile, as the data is not updated in real time but is
refreshed from operational systems on a regular basis.
147 Prepared by Aklilu E. @WSU
Data Mining
 Data mining is the process of extracting valid,
previously unknown, comprehensible, and
actionable information from large databases
and using it to make crucial business
decisions.
 Data mining is used in a wide range of
industries including retail/marketing, banking,
insurance, and medicine.
 There are four main operations associated
with data mining techniques, which include
predictive modeling, database segmentation,
link analysis, and deviation detection.
148 Prepared by Aklilu E. @WSU
Data Mining…
OPERATIONS DATA MINING TECHNIQUES
Predictive modeling Classification Value prediction

Database segmentation Demographic clustering Neural clustering

Link analysis Demographic clustering Neural clustering Similar time sequence discovery

Deviation detection Statistics Visualization

149 Prepared by Aklilu E. @WSU


End of Chapter VII
 Any Questions??

150 Prepared by Aklilu E. @WSU

You might also like