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

DB 1

Uploaded by

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

DB 1

Uploaded by

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

DEPARTMENT OF COMPUTER SCIENCE

1
OOP COURSE OUTLINE

Course Title Fundamentals of Database Management System

Degree Program BSc. Degree in Computer Science

Course Code COSC2072

Credits/Contacts 4/5

Prerequisite COSC2071

Semester Semester 2, year 2

Status of Course Compulsory

Course Objectives At the end of the course the student will be


2
and Learning able to do:
Course Objectives and LO----------

Differentiate data models and database


languages.

Understand ANSI-SPARC Architecture and


multi user DBMS Architecture.

Use Relational Algebra and Relational


Calculus concepts.

Define data requirement or business unit in an


organization. 3
Course Objectives and LO----------

Develop logical database design based on


the conceptual data model.

Understand how to use DDL and DML in MS


SQL Server database.

Course The development of efficient database


Description
applications requires understanding of the
fundamentals of database management
systems techniques for the design of 4

database and principles of database


Course Description--------

Course In this course fundamental concept


Description
related to database and Database
Management System will be covered.

The different approaches for data


handling and their advantage and
disadvantage, the database
environment, data models, and multi
user DBMS architecture are some of the5
Course Description--------

Course Relational data model is the model to be


Description
covered in depth therefore the course
cover relational algebra and relational
calculus, basic concepts and
terminologies in relational data model and
basic database development steps and
tools used in this model.

The laboratory session teaches how to


6

write different SQL statements to


Course Content

UNIT ONE: INTRODUCTION TO DATABASE

1.1 Basic Concepts of Database and DBMS

1.2 Data Management Approach

1.3 Advantages of Database and DBMS

1.4 The Three level ANSI-SPARC Architecture

1.5 Database Languages

1.6 Functions and components of DBMS


7
1.7 Multi user DBMS Architecture
Course Content Continued

UNIT TWO: RELATIONAL DATA MODEL

2.1 Basic concept and types of Data models

2.2 History of Relational Data model

2.3 Terminologies in Relational Data model

2.4 Integrity constraints in Relational Data model

2.5 Views and their importance

UNIT THREE: RELATIONAL ALGEBRA AND CALCULUS

3.1 Relational Algebra

3.2 Relational Calculus


8

UNIT FOUR: CONCEPTUAL DATABASE DESIGN


Course Content Continued

UNIT FIVE: LOGICAL DATABASE DESIGN

5.1 Concepts of Logical Database Design

5.2 Normalization

5.3 Logical Database Design Methodology

UNIT SIX: STRUCTURED QUERY LANGUAGE(SQL)

6.1 Basics of MS-Access (Query By Example)

6.2 Structured Query Language (SQL)


9

6.3 Introduction to SQL


Teaching and Assessment Methods

Teaching and Lecture


learning
Discussion and case studies
Methods
Laboratory, Practical work

Assessment/ Theoretical Test------------------------------(15%)


Evaluation and
Assignment----------------------------------- (10%)
Grading System
Project Work----------------------------------(25%)

Final Exam------------------------------------(50%)

Text Books 1. Thomas Connoly, Carolyn Begg; Database


10
Systems: A practical guide to Design,
Teaching and Assessment Methods

Reference 1. Ramez Elmasri, Shamkant B. Navathe, Fundamentals of


Materials Database Systems,5th ed., 2009, Pearson Education, Inc.
2.
Rod Stephens, Beginning Database Design Solutions,
2009, Wiley Publishing, Inc., Indianapolis, Indiana
3.
Database Management System; 2015, Tutorials Point (I)
Pvt. Ltd. (tutorialspoint.com)

4. Ramez Elmasri, Shamkant B. Navathe, Fundamentals of

Database Systems, 6th ed., 2011, Pearson Education, Inc.,

publishing as Addison-Wesley; Boston, Massachusetts


(Soft Copy) 11

5. Silberschatz, Abraham, Henry F. Korth and S. Sudarshan. .


CHAPTER ONE

INTRODUCTION TO DATABASE

12
1. What is Database
Database is a very large integrated collection of data

It is used to maintain internal records, to present data to


customers and clients on the World-Wide-Web, and to
support many other commercial processes.

By data, we mean known facts that can be recorded and


that have implicit meaning.

For example, consider the names, telephone numbers, and


addresses of the people you know.

You may have recorded this data in an indexed address


13

book or you may have stored it on a hard drive, using a


1. What is Database-----
This collection of related data with an implicit meaning is a
database.

A database has the following implicit properties:

A database represents some aspect of the real world,


sometimes called the miniworld or the universe of
discourse (UoD).

Changes to the miniworld are reflected in the database.

Database Management System(DBMS)– a powerful


tool(software package) for creating and managing large
14

amounts of data efficiently and allowing it to persist over


1. What is Database-----
Data management involves both definition and the
manipulation of the data

So the term database refers to a collection of data


that is managed by a DBMS.

Thus the DB course is about:

How to organize data ;supporting multiple users;


efficient and effective data retrieval ;secured and
reliable storage of data; maintaining consistent
15

data
1. What is Database-----
What is a Database?- It is a collection of related facts

Filing Cabinet
Hard disk full of data

Diary

Library

DBMS + Database
=
Database System 16
2. Database Approaches
Data management passes through the different levels
of development. The common are discussed as
follows:

I. Manual Approach

Data storage and retrieval follows the primitive and


traditional way of information handling where cards
and paper are used for the purpose.

Files for as many event and objects as the


17
organization are used to store information.
2. Database Approaches--------
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.

It requires intensive human labor to organize and


access data
18
Use indexing system to facilitate access to the data.
Example , Personal Calendar

We might start by building a file with the following structure:

What Day Time with_whom Where

Lunch 10/24 1pm Abebe Bole

CS123 10/25 9am Seble Room 234

Shop 10/26 9am Ayele Piassa

Dinner 10/26 6PM Elfinesh Café


This calendar is easy to deal with.

19
Let us also build phone address book

Abebe A. 0911164743

Seble K. 0912150844

Ayele L. 0913170841

Elfinesh W. 0911169673

Ermias H. 0912151043

Worku A. 0911199904

Worku D. 0912620410

Abebe D. 0914556768
20
Limitations of the Manual Approach
1. Problem of Data Organization

Suppose we want to cancel one of our appointments.

Two conceptual “entities” -- address and calendar -- with


a relationship between them, linking people in the
calendar to their contact information.

2. Problem of Efficiency

Size of your personal address book is probably less than


one hundred entries, but there are things we'd like to do
quickly and efficiently.
21

“Give me all appointments on 10/28”


Limitations of the Manual Approach
What would happen if you were using a business
calendar with hundreds of thousands of entries?

3. Prone to error

4. Difficult to update, retrieve, integrate

5. You have the data but it is difficult to compile the


information

6. Significant amount of duplication of data

7. Cross referencing is difficult 22


What is the Solutions?
What is the solution to overcome the problems or
difficulties inherited in the manual data handling
approaches?

Two computerized approaches evolved to overcome


this limitations

Traditional File Based Approach Decentralised

Database Approach Centralised

23
2. Traditional File Based Approach
This approach uses computer for data processing to
the business community, via the device for data
storage and processing increase.

File based systems were an early attempt to


computerize the manual filing system.

This approach is the decentralized computerized


data handling method.

Since every application defines and manages its


24
own data, the system is subjected to serious data
25
Limitations of Traditional File-Based Approach
1. Data Redundancy (Duplication of data)

Same data is held by different programs

Wasted space (Uncontrolled duplication of data)

2. Separation and isolation of data

Each program maintains its own set of data.

Users of one program may be unaware of potentially

useful data held by other programs.


26

Limited data sharing


Limitations of Traditional File-Based Approach-----
3. Data Inconsistency and confusion. Eg. Consider an organization

Personnel Department stores details relating to each member.

Payroll Department stores salaries of each staff

There are potentially different values and/or different formats

for the same item.

Consider the duplication of data between the payroll and

personnel departments.

If an employee moves house and the change of address is


27

communicated only to personnel and not to payroll, the


Limitations of Traditional File-Based Approach-----
4. Data Dependence

File structure is defined in the program code and is dependent


on the application programming language.

Each application program must have its own processing


routines for reading, inserting, updating and deleting data.

5. Incompatible file formats (Lack of Data Sharing and Availability)

Programs are written in different languages, and so cannot


easily access each others files.

Eg.
28
personnel writes in C
Limitations of Traditional File-Based Approach-----
Suppose payroll wants to know when a certain employee will be
on pension.

It is difficult to share this information unless we have another


application programmer to write software to convert the files to
some common format.

6. Poor Security and Administration

Unauthorized people may access the data.

7. Data Anomalies

A. Modification Anomalies:
29
A problem experienced when one or more data value is
Limitations of Traditional File-Based Approach-----
B. Deletion Anomalies:

A problem encountered where one record set is


deleted from one application but remain untouched in
other application programs.

C. Insertion Anomalies:

A problem experienced whenever there is a new data


item to be recorded, and the recording is not made in
all the applications.
30
3. Database Approach
The limitation of the file based can be attributed to two
factors:

Definition of data is embedded in the application programs,


rather than being stored separately and independently.

There is no control over the access and manipulation of


data beyond that imposed by the application programs.

To become more effective, a new approach was required


by the name Database Approach.

What emerged were the database and database


31

management systems.
3. Database Approach-----
The database systems is presented for user with a
view of data organized as tables called relations

It emphasizes the integration and sharing of data


throughout the organization.

Database is a collection of logically related data where


these logically related data comprises

entities, attributes, relationships, and business rules of


an organization's information.
32

Database is deigned once and used simultaneously by


3. Database Approach------
Unlike the traditional file based approach ,in database
there is 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.

33
3. Database Approach-----
A Database is a shared collection of logically related data
designed to meet the information needs of an organization-
(Centralized System).

System Catalog (Data Dictionary or Metadata) provides the


description of the data to enable program–data independence.

The database contains not only the database itself but also a
complete definition or description of the database.

This definition is stored in the system catalog, which contains


information such as the structure of each file, type and storage
format of each data item and various constraints on the data..
34

The information stored is called metadata and it describes the


Benefits of the Database Approach
1. Data can be shared:

Two or more users can access and use same data


instead of storing data in redundant manner for
each user.

2. Improved accessibility of data:

By using structured query languages, the users can


easily access data without programming experience.

3. Quality data can be maintained: 35


Benefits of the Database Approach------
4. Integrity can be maintained:

Data at different applications will be integrated together


with additional constraints to facilitate validity and
consistency of shared data resource.

5. Security measures can be enforced:

The shared data can be secured by having different levels


of clearance

6. Speed: data storage and retrieval is fast

7. Centralized information control: 36


Benefits of the Database Approach------

8. Redundancy can be reduced:

Isolated data is integrated in database to decrease


the redundant data stored at different applications

9. Inconsistency can be avoided:

Controlled data redundancy will avoid inconsistency


of the data in the database to some extent.

10. Data Independence

Applications insulated from how data is structured37


Benefits of the Database Approach------
11. Standards can be enforced:

The different ways of using and dealing with data by


different units of the organization can be balanced
and standardized by using database approach.

12. Less Labor:

Unlike the other data handling methods, data


maintenance will not demand much resource

38
Limitations and Risk of Database Approach------
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 administer the


system

Complex backup and recovery services from the users


perspective

Reduced performance due to centralization and data


independency
39

High impact on the system when failure occurs to the


DBMS Functions
A DBMS performs several important functions that guarantee the
integrity and consistency of the data in the database.

Most of those functions are transparent to end users, and most can
be achieved only through the use of a DBMS. They include:

Data Dictionary Management

Data Storage Management

Data Transformation and Presentation

Security Management

Multiuser Access Control

Backup and Recovery Management , Data Integrity Management 40


DBMS Functions-----
1. Data Dictionary Management

DBMS stores definitions of the data elements and their


relationships (metadata) in a data dictionary.

In turn, all programs that access the data in the database


work through the DBMS.

The DBMS uses the data dictionary to look up the required


data component structures and relationships.

Additionally, any changes made in a database structure


are automatically recorded in the data dictionary.
41

In other words, the DBMS provides data abstraction, and it


DBMS Functions-----
A useful data dictionary system should store and manage the
following types of information:

Descriptions of the schemas of the database system.

Detailed information on physical database design, such as


storage structures, access paths, and file and record sizes.

Descriptions of the types of database users, their


responsibilities, and their access rights.

Descriptions of the database transactions and applications


and relationships of users to transactions.

The relationship between database transactions and the data


42

items referenced by them.


DBMS Functions-----
Usage statistics such as frequencies of queries and
transactions and access counts to different portions of the
database.

2. Data Storage Management

The DBMS creates and manages the complex structures


required for data storage.

A modern DBMS provides storage not only for the data, but
also for related data entry forms or screen definitions, report
definitions, data validation rules, procedural code, structures
to handle video and picture formats, and so on.
43

Data storage management is also important for database


2. Data Storage Management ----
Performance tuning relates to the activities that make the
database perform more efficiently in terms of storage and
access speed.

Although the user sees the unit, the DBMS actually stores
the database as a single data storage in multiple physical
data files.

See the following figure. Such data files may even be


stored on different storage media.

Therefore, the DBMS doesn’t have to wait for one disk


request to finish before the next one starts. 44
DBMS Functions-----
3. Multi Access Control

To provide data integrity and data consistency, the DBMS uses


sophisticated algorithms to ensure that multiple users can
access the database concurrently without compromising the
integrity of the database.

4. Backup and Recovery Management

The DBMS provides backup and data recovery to ensure data


safety and integrity.

Current DBMS systems provide special utilities that allow the


DBA to perform routine and special backup and restore 45

procedures.
DBMS Functions-----
5. Data Integrity Management

The DBMS promotes and enforces integrity rules, thus


minimizing data redundancy and maximizing data consistency.

The data relationships stored in the data dictionary are used to


enforce data integrity.

Ensuring data integrity is especially important in transaction-


oriented database systems.

6. Database Access Languages and API

The DBMS provides data access through a query language.


46
A query language is a nonprocedural language—one that lets
DBMS Functions-----
7. Data Communication Interface

Current-generation DBMSs accept end-user requests via multiple,


different network environments.

For example, the DBMS might provide access to the database via the
Internet through the use of Web browsers.

In this environment, communications can be accomplished in several


ways:

End users can generate answers to queries by filling in screen forms


through their preferred Web browser.

The DBMS can automatically publish predefined reports on a Website.

The DBMS can connect to third-party systems to distribute 47

information via e-mail or other productivity applications.


Database Languages
DBMS should have facilities to define the database, manipulate the
content of the database and control the database.

It provides the following facilities:

1. Data Definition Language (DDL):

Language used to define each data element required by the


organization.

Commands for setting up schema or database

These commands are used to setup a database, create, delete and


alter table with the facility of handling constraints

2. Data Manipulation Language (DML):


48
Is a core command used by end-users and programmers to store,
Database System Environment
The term database system refers to an organization
of components that define and regulate the collection,
storage management, and use of data within a
database environment.

From a general management point of view, the


database system is composed of the five major parts:
hardware, software, people, procedures, and data.

49
Database System Environment------
Taking a DBMS as a system, To design and use a
database, there will be the interaction or integration of
Hardware, Software, Data, Procedure and People.

1. Hardware:

These components are comprised of various types of


personal computers, mainframe or any server computers
to be used in multi-user system, network infrastructure,
and other peripherals required in the system.

2. Software:
50

are collection of commands and programs used to


Database System Environment------
Like the DBMS software, application programs,
operating systems, network software, language
software and other relevant software.

3. Procedure:

This is the rules and regulations on how to design and


use a database.

It includes procedures like how to log on to the DBMS,


how to use facilities, how to start and stop transaction,
how to make backup, how to treat hardware and 51
Database System Environment------
4. Data:

Data is the most important component to the user of


the database.

There are two categories of data in any database


system: that is Operational and Metadata.

Operational data is the data actually stored in the


system to be used by the user.

Metadata is the data that is used to store information


52

about the database itself.


Database System Environment------
The structure of the data in the database is called the
schema, which is composed of the Entities, Properties
of entities, and relationship between entities and
business constraints.

5. People:

This component is composed of the people in the


organization that are responsible or play a role in
designing, implementing, managing, administering and
using the resources in the database.
53

This component includes group of people who are


3. Database Development Life Cycle (DDLC)
1. Planning:

It is identifying information gap in an organization and


propose a database solution to solve the problem.

2. Analysis:

It 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.
54

3. Design:
3. Database Development Life Cycle (DDLC)
A. Conceptual Design:

Concise description of the data, relationship between


data and constraints on the data.

There is no implementation or physical detail


consideration.

Used to elicit and structure all information


requirements

B. Logical Design:
55

It is a higher level conceptual abstraction with


3. Database Development Life Cycle (DDLC)
C. 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: 56


5. Roles in Database Design and Use
There are group of roles played by different stakeholders
of the designing and operation of a database system.
These are:

1. Database Administrator (DBA)

Responsible to oversee, control and manage the database


resources

Authorizing access to the database

Coordinating and monitoring the use of the database

Responsible for determining and acquiring hardware and


57

software resources
5. Roles in Database Design and Use------
Involves in all steps of database development

2. Database Designer (DBD)

Identifies the data to be stored and choose the appropriate


structures to represent and store the data.

Should understand the user requirement and should choose


how the user views the database.

Involve on the design phase before the implementation of the


database system.

3. Application Programmer and Systems Analyst


58
System analyst determines the user requirement and how the
5. Roles in Database Design and Use------
The application programmer implements these specifications
as programs; code, test, debug, document and maintain the
application program.

The application programmer determines the interface on how


to retrieve, insert, update and delete data in the database.

The application could use any high level programming language


according to the availability, the facility and the required
service.

4. End Users

Workers, whose job requires accessing the database frequently


59

for various purposes, there are different group of users in this


Example of a Database
Part of a UNIVERSITY environment. Information concerning students,
courses, and grades in a university environment

Some mini-world entities:

STUDENTs

COURSEs

SECTIONs (of COURSEs)

Some mini-world relationships:


DEPARTMENTs

SECTIONs are of specific COURSEs


INSTRUCTORs

. STUDENTs take SECTIONs

COURSEs have prerequisite COURSEs

INSTRUCTORs teach SECTIONs


60

COURSEs are offered by DEPARTMENTs


61
62
An Example (cont'd.)
Construct UNIVERSITY database
Store data to represent each student, course, section, grade
report, and prerequisite as a record in appropriate file
Relationships among the records
Manipulation involves querying and updating
Examples of queries:
Retrieve the transcript
List the names of students who took the section of the ‘Database’ course
offered in fall 2013 and their grades in that section
List the prerequisites of the ‘Fundaments of Database’ course

Examples of updates:
Change the class of ‘Lemma’ to sophomore
Create a new section for the ‘Database’ course for this semester
Enter a grade of ‘A’ for ‘Lemma’ in the ‘Database’ section of last
semester
63
Data Abstraction(Categories of data models)
Data can be described at three levels of abstraction

Physical schema

The lowest level schema

Describes how data are stored and indexed

Conceptual (or logical) schema

What (not how) data are stored

Describes data in terms of the data model

External (or view) schema

The highest level schema

Describes how some users access the data

There can be many different views


64
Levels of Abstraction

65
Typical DBMS Structure/Database System

66
Database Components(Structure)
1. Disk space (storage) manager

responsible for interaction with the OS file system

Allows other levels of the DBMS to consider the data as a collection


of pages

2. Buffer manager

responsible for bringing pages into main memory from disk

Including the management of a replacement policy when main


memory is full

3. File and access code

allows the query evaluation system to request data from lower levels

67
Database Components(Structure)------
4. Query evaluation
most modern DBMSs will optimize queries
There are often multiple equivalent queries
The query optimizer determines an efficient execution plan for a
query
5. Transaction lock manager
responsible for allowing concurrent access
While maintaining data integrity
6. Recovery manager
responsible for maintaining a log and restoring the system after
a crash
68
Database System Architecture
i. Centralized and Client-Server Architectures
Centralized DBMS: combines everything into single
system including- DBMS software, hardware,
application programs and user interface processing
software.

a. Specialized Servers
It includes the with Specialized
following three things:functions:
File Servers
Printer Servers
Web Servers
E-mail Servers
b. Clients:
Provide appropriate interfaces and a client-version of the

system to access and utilize the server resources.

Clients maybe diskless machines or PCs or Workstations

with disks with only the client software installed.

Connected to the servers via some form of a network

c. DBMS Server
(LAN: local area network, wireless network, etc.)
Provides database query and transaction services to the
clients

Sometimes called query and transaction servers


ii. Two Tier Client-Server Architecture
User Interface Programs and Application Programs run on the client side

Interface called ODBC (Open Database Connectivity) provides


an Application program interface (API) allow client side
programs to call the DBMS.

A client program may connect to several DBMSs.

Physical two-tier client-server


architecture
iii. Three Tier Client-Server Architecture
Common for Web applications

Intermediate Layer called Application Server or Web Server:

stores the web connectivity software and the rules and business logic (constraints) part of the
application used to access the right amount of data from the database server

acts like a conduit for sending partially processed data between the database server and the client.

Additional Features- Security:

encrypt the data at the server before transmission

decrypt data at the client

You might also like