Вы находитесь на странице: 1из 42

Fundamentals of Database Systems

(CSE 3207)

November 18, 2017

Adama Science & Technology University


Outlines
Course Title: Fundamentals of Database Systems
Course. No: CSE3207
Credit: 3
Prerequisite: Fundamentals of Information Systems
Contact Hours: 2 Lecture hrs/week, 2hrs Lab/week
Course Objectives:
At the end of this course, students will be able to:
Differentiate between traditional file organization and modern
database system
Know the concept of a database
Distinguish different types of data models
Manipulate databases with database definition and manipulation
languages
Analyze a given situation/problem and design a decent database
11/18/2017 2
Course Chapters - Units
Chap1- Fundamental Concepts of a Database Systems
Introduction to Database Systems
Database System versus File Based System
Components and Functionalities of a Database Management
System
Types of Data Models
People who deal with databases

Chap2- Entity - Relationship (E/R) Data Model


E/R Modeling,
Elements of E/R Model
Design Principles
Keys and Constraints

11/18/2017 3
Course Chapters
Chap3- Database Planning, Design and Administration
Database Planning
Requirements collection and analysis
DBMS Selection
Conceptual design
Logical Design
Physical Design

Chap4- Relational Data Model


Structure of Relational Database
Entity-Relational (E/R) Model to Relational Model Mapping
Functional Dependencies
Multi-valued Dependencies
Normal Forms and Normalization
11/18/2017 4
Course Chapters -
Chap5- Distributed Databases and Transaction processing
Distributed data storage
Distributed query processing
Transactions, Failure and Recovery
Distributed transaction model
Concurrency control

Chap6- Relational Algebra


Fundamental Operations of Relational Algebra
Additional and Extended Operations

Chap7- Physical database design


Storage and file structure;
Indexed files; hashed files;
B-trees; files with dense index;
Files with variable length records;
Database efficiency and tuning
11/18/2017 5
References
Fundamentals of Database Systems: Elmasri, Navathe; Pearson; 4th
Edition.
Database System: The Complete Book: H.G. Mollina, J.D. Ullman, J.
Widom; Prentice Hall; 1st Edition
Database Management Systems: Raghu Ramakrishnan, Johannes
Gehrke; McGraw Hill; 2nd Edition
Database System Concepts: Silbershatz, Korth, Sudarshan; McGraw
Hill; 4th Edition
Database System A practical Approach to Design, Implement,
and Management, Thomas M.Connolly, 2nd Ed; Pearson Education,
2004.

11/18/2017 6
Chapter 1:
Fundamental Concepts of Database Systems

11/18/2017 7
Introduction to Database Systems
What is a Database?
Database: - is a shared collection of logically related data, and a
description of this data, designed to meet the information needs of
an organization.
A database can be viewed as a repository for data
It is a large collection of related data
It is collection of coherent (consistent) data
It is designed, built and populated to address a specific situation in
the real world
A database models aspects of a real world organization
(e.g universities, hospitals, airlines, etc)
Example: Students database
Entities (eg., students, courses)
Relationship (eg., Abebe is taking CS -2041 in sem.II)
If there will be changes in the organization, then the
database may also need to be changed
8
Introduction to Database Systems (contd.)
Databases are everywhere!
Examples:
Personnel databases (employees database)
Airlines reservation
Banking
Data on the Web
Accessed/changed by many people (Facebook, Twitter etc...)
Scientific Databases
Biology: (e.g., DNA sequences of genes, amino-acid
sequences of proteins, genes expressed in tissues (up to
several Gigabytes)
Astronomy: (e.g., location and spectra of astronomic objects
(up to several Terabytes)

11/18/2017 9
Data Base Management System (DBMS)
What is Database Management System (DBMS) ?
A DBMS is a software package designed to store and manage
databases
A DBMS provides generic functionality (see previous slide) that
otherwise would have to be implemented over and over again
Reduced application development time
Several brands, e.g., Oracle Xi/Yg (Oracle), DB2 (IBM), SQL
Server, Access (Microsoft), MySQL, PostgreSQL, HSQLDB, SQLite
(open source)
A DBMS provides a simplified environment for programmers and
users
DBMS is a software that facilitates the processes of defining,
constructing, manipulating and sharing databases
Database System is used to refer to the combination of database
and database management system (DBMS)

11/18/2017 10
Data Base Management Systems (DBMS)
DBMS is a software that facilitates the processes of:
Defining database: involves specifying data types, structure and
constraints.
Constructing database: building databases and storing the data into
a storage media is possible
Manipulating database: retrieving and updating data from and into
the storage
Sharing database: allows multiple users to access data
Operations on Database Systems:
Design
Define structure and types of data
Construction
Create data structures of DB, populate DB with data
Manipulation of Data
Insert, delete, update
Query: Which department pays the highest salary?
Create reports: List monthly salaries of employees, organized by department,
with average salary and total sum of salaries for each dept
11
Database Systems Environment

11/18/2017 12
Evolution of a Database System
1st generation was file system, such as Indexed Sequential
Access Method (ISAM) and VSAM (Virtual Storage Access
Method);
2nd generation was hierarchical database systems, such
as IMS and System 2000.
3rd generation was the network model CODASYL
(Conference on Data Systems Languages) database systems.
4th generation relational database technology.
Commercially available systems in late 1970s and early 80s, such as
Oracle, SQL/DB and DB2 and INGRES
Relational and past-generation database systems are called
conventional database systems.

13
Evolution of a Database System (contd.)

Shortcomings of the conventional database technology :


too simple for modeling complex nested entities, such as design and
engineering objects, and complex documents.
support only a limited set of atomic data types, such as integer,
string, etc.
The performance of conventional database systems, unacceptable for
various types of compute-intensive applications, such as simulation
programs in computer-aided design and programming language
environments.
Application programs are implemented in some algorithmic programming
language
..
5th generation database technology will be characterized by
a richer data model and a richer set of database facilities.
Both the extended relational and object-oriented approaches are viable,
and that most likely systems adopting either approach co-exist.

14
Landmarks in Database System History
1950s and early 1960s:
Magnetic disc into the usage of data storage.
Late 1962s and 1970s:
Hard disks come into play in late 1960s.
A paper by Codd [1970] on relation model, querying and relational
database.
1980s:
commercially available systems in late 70s and early 80s, such as
Oracle, SQL/DB and DB2
Late 1990s:
WWW and Multimedia
Object-Oriented Programming

15
A Database System Implementation Requirements
An Ideal database system implementation should support:
Consistency: ensure that the data itself is consistently
updated and used.
Concurrency: enable multiple users and systems at the same
time
Performance: support reasonable response times.
Standard Adherence: support standard language for defining
structure of a database and manipulating data
DDL: Data Definition Languages
DML: Data Manipulation Languages
Security (Data Integrity): provide away to set access
permissions.
Reliability: keep the stored data intact.

16
File Based System versus Database System
File-based: collection of application programs that perform services for
the system end-users
It is an early attempt to computerize the manual filing system
that we are all familiar with
In manual data management: various paper based
information/correspondences are labeled and stored in filing cabinet(
about project, product, task, client, or employee)
Sequential searching when a piece of information is required
Manual systems work for very small scale data processing need
But our information need grows exponentially from time to time
Hence manual system fail to satisfy the growing volume of data
The file based system was developed in response to the needs of
industry for more efficient data access.
Still the file based system doesnt allow central data sharing
Rather each data processing (DP) unit controls and uses its own data

17
Example of File Based Systems
Limitations of File Based System
Data redundancy and inconsistency: different format and standards
of the files in the file system
Difficulty in accessing data: sequential access
Data isolation: Related data may be scattered across files
Integrity problems: Maintaining constraints across files and
applications would be difficult
Atomicity problems: operations can not be performed as a single
unified operation
Concurrent access anomalies: Uncoordinated access to the data by
different applications
Security problems: vulnerable to security treats and attacks
Incompatible file formats: the structures are dependent on the
application programming language
Database Approach
All the above limitations of the file-based approach can be
attributed to two factors:
a. The definition of the data is embedded in the application
programs, rather than being stored separately and
independently;
b. 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
What emerged were the database and the Database
Management System (DBMS)
Database Approach
It is a single repository that can be used simultaneously by
many users
It is no longer owned by one department but is a shared corporate
resource
It holds not only the organizations operational data but also a
description of this data
The description of the data is known as the system catalog (or
data dictionary or metadata the data about data)
Programdata independence
The data should be related some how through the facility called
relationship
Advantages of Database Approaches
Data Redundancy is avoided
Improved data accessibility (Adequate data sharing)
Improved maintenance through data independence (Data is
independent of application programs)
Data availability is achieved, (information is easier to use and access)
Improved backup and recovery services
Data Consistency

Challenges of database Approach ( When not to use database):


Sense of ownership and responsibility for data are easily lost
The Database may become a target of security breaches
Cost of DBMS
Data Model
Data Model - A set of concepts that can be used to describe the structure of a
database: the data types, relationships, constraints, semantics and operational
behavior
According to the types of concepts they use to describe the database structure, we
have the following 3 types of data models:
High-level or conceptual data models
provide concepts that are close to the way many users perceive data,
Low-level or physical data models
provide concepts that describe the details of how data is stored in the computer.
Concepts provided by low- level data models are generally meant for computer
specialists, not for typical end users.
Representational or implementation data models
Are between high-level and low-level data models
provide concepts that may be understood by end users but that are not too far
removed from the way data is organized within the computer.
Representational data models hide some details of data storage but can be
implemented on a computer system in a direct way.

11/18/2017 23
Types of Data Models
In any data model it is important to distinguish between the description of
the database and the database itself
The description of a database is called the database schema, which is
specified during database design and is not expected to change frequently

After 00s, it is focused on service based databases housing the main databases
Fig: Types of Data Models
11/18/2017 24
Types of Data Models (contd.)
Types of High-Level (Conceptual Model)
EntityRelationship Model
Entity
Attribute
Relationship
Object-Oriented Model
advancement of the Object-Oriented Programming (OOP)
object-oriented data model
object-relational data model

25
Types of Data Model (contd.)
Implementation data models are the models used most frequently in
traditional commercial DBMSs
Hierarchical Model
It organizes data in a tree like structure
A serious of data in a record has associated data fields
Hierarchy of parent and child data segments
Parent-child relationship is one to many- hence there is a repetition
of information
Examples: Employee Record heirarchy

26
Types of Data Model (contd.)
Network Model
The model is a simple network that consists of links and
intersection records
permitted the modeling of many-to-many relationships in data
In 1971, the Conference on Data Systems Languages
(CODASYL) formally defined the network model
Example: Student- course data
Types of Data Model (contd.)
Relational Model
The history of the relational database began with E.F. Codd's
1970 paper
Allows the definition of data structures, storage and retrieval
operations and integrity constraints
The data and relations between them are organized in tables
Examples:

28
Database Architecture based on level of Abstraction
A major aim of a database system is to provide users with an
abstract view of data,- hiding certain details of how data is stored
and manipulated
Since a database is a shared resource, each user may require a
different view of the data held in the database
The American National Standards Institute/Standards Planning and
Requirements Committee (ANSI-SPARC) introduced the three-level
architecture of the database ( three-schema architecture) based on
their degree of abstraction
The goal of the three-schema architecture is to separate the user
applications and the physical database.
In this architecture, schemas can be defined at the following three levels:
1. External level: The users view of the database.
2. Conceptual level: The community view of the database
3. Internal level: Physical representation of the database on computer
Database Architecture based on level of Abstraction (contd.)
External level:
It includes a number of external schemas or user views.
This level describes that part of the database that is relevant to each user
E.g.: one user may view dates in the form (day, month, year), while another may
view dates as (year, month, day), some views may include derived or calculated
data, data not actually stored in the database

Conceptual level:
It has a conceptual schema, which describes the structure of the whole database
for a community of users.
It hides the details of physical storage structures and concentrates on describing
entities, data types, relationships, user operations, and constraints

Internal level:
It has an internal schema, which describes the physical storage structure of the
database.
The internal schema uses a physical data model and describes the complete details of
data storage and access paths for the database.
Concerned with such things as: Storage space allocation for data, Record
description for storage, Record placement, etc
Database Architecture based on level of Abstraction (contd.)

The three-schema architecture can be used to explain the


concept of Data Independence.
Data independence can be defined as the capacity to change
the schema at one level of a database system without having to
change the schema at the next higher level.
We can define two types of data independence:
Logical data independence change the logical
schema without having to change the external schemas
Physical data independence change the internal
schema without having to change the logical schema

11/18/2017 31
Database System Arch. based on number of machines
Based on the number of machines the database system runs, The database
systems Architecture can be:
Centralized Database System Architecture
are those that run on a single computer system and that do not
interact with the other computer system except for displaying
information on display terminals

Such database systems span from single-user database system that


run on a single personal computer to a high-performance database
systems that run on a main frame

Client/Server Architecture:
In the Client/Server architecture the client processes run separately
from the server processes, usually on a different computer
Client /Server can be:
Two-Tier Client/Server Architecture
Three-Tier client/Server Architecture
Client/Server Architecture
Client Client Client Client Client
Process
File Server Mail Server DBMS Server
Server
Process
Fig: General Structure of client/server architecture
Two-Tier Client/Server Architecture
is the simplest client/server application
Client Processes: provide the interface for users
Server Processes: provide an interface with the data storage.
The business rules (tier) can be included to the either side of the server or the
client

Three-Tier Client/Server Architecture


The standard model for a three-tier application has
User tier (GUI or Web Interface),
Business tier (Application Server or Web Server)
Data tier (Data Server)

33
Client/Server Architecture (contd.)

34
Components and Functionalities of Database Systems

Application Application Query Tools Administration


Interfaces Programs Tools

Compiler and DML Queries DDL Queries


Linker
Application
Program Object DML Compiler and DDL Interpreter
Code Organizer
Query Evaluation
Engine Query Processor

Authorization and Transaction


Buffer Manager File Manager Integrity Manager Manager

Storage Manager

Data Dictionary Disk Storage


Indices
Data Statistical Data

Fig:. Database System Structure


35
Components and Functionalities of Database Systems

1. Disk Storage: The database and the DBMS catalog are usually stored on
disk. Access to the disk is controlled primarily by the operating system
(OS), which schedules disk input/output.
2. Storage Manager: a program module responsible for storing, retrieving
and updating data in the database
Components of Storage Manager:
Authorization and integrity manager: checks for credentials of the
users and tests for the integrity constraints.
Transaction manager: enables to preserve consistency despite
system failure and avoid conflict at the time of concurrent transaction.
File manager: manages disk storage allocation and data structure for
stored data.
Buffer manger: is responsible for fetching data from disk storage to
the main memory.

36
Components and Functionalities of Database Systems

3. Query Processor: is a module that handles queries as well as requests


for modification of the data and metadata
Components :
DDL interpreter (compiler): processes DDL statements for schema
definition (meta-data) and records the definitions in the data
dictionary
DML compiler: analyzes, translates and optimizes DML statements
Query evaluation engine: execute low-level instructions generated by
the DML compile
Participants in Database System

On the scenes

Behind the scenes

11/18/2017 38
Participants in Database System
Database Users
Database users are end users whose jobs require access to
the database for querying, updating, and generating
reports; the database primarily exists for their use.
Users are differentiated by the way they expect to interact
with the system
Sophisticated Users form requests in a database query
language
Nave Users use one of the permanent application
programs that have been written previously, Eg. Bank
tellers, clerical staff
Participants in Database System
Database Administrator
In any organization where many persons use the same resources, there is
a need for a chief administrator to oversee and manage these resources.
Primary resource is the database itself
The secondary resource is the DBMS and related software.
Database Administrator (DBA is responsible for administering these
resources
The DBA is responsible for:
Authorizing access to the database,
Coordinating and monitoring its use,
Acquiring software and hardware resources as needed
The DBA is accountable for problems such as breach of security or poor
system response time.
Reading Assignments
1. The Characteristics of Database Approach can be summarized by
the four points below. Distinguish between each of them:
Self-Describing Nature of a Database System
Program-Data Independence
Sharing of Data and Multi-user Transaction Processing
Support of Multiple Views of the Data
2. Discuss and Report the Evolution of Database focusing on Its
generations
3. Thoroughly discuss each and every components of Database Systems
4. Summarize the historical developments of Database systems

Adama Science & Technology University


Chapter 2:
Entity Relationship Model

11/18/2017 42

Вам также может понравиться