Sunteți pe pagina 1din 53

Sri Lanka International Buddhist Academy

Database Management
Systems I

Lecture 1

8/18/2019 IT Department @ SIBA Campus 1


Data and Databases
 Learning Objectives
 Upon successful completion of this chapter, you will be
able to:
 describe the differences between data, information, and
knowledge;
 define the term database and identify the steps to
creating one;
 describe the role of a database management system;
 describe the characteristics of a data warehouse; and
 define data mining and describe its role in an
organization.

8/18/2019 IT Department @ SIBA Campus 2


Data, Information, and
Knowledge
 Data are the raw bits and pieces of information with no
context.

 Data can be quantitative or qualitative. Quantitative data


is numeric, the result of a measurement, count, or some
other mathematical calculation. Qualitative data is
descriptive.

8/18/2019 IT Department @ SIBA Campus 3


8/18/2019 IT Department @ SIBA Campus 4
Examples of Data
 editing a document in a word
processor
 MP3 music file
 a video file
 a spreadsheet
 a web page
 an e-book

8/18/2019 IT Department @ SIBA Campus 5


Introduction

 What is a database?
A database is a collection of related
data
(examples???)

 A database management system


(DBMS) is a software package
designed to create and maintain
databases
(examples?)
8/18/2019 IT Department @ SIBA Campus 6
Introduction DBMS (contd…)
 The DBMS is a general-purpose software system

 Defining
 Specifying the data types, structures, and
constraints for the data to be stored in the
database.
 Constructing
 The process of storing the data itself on some
storage medium that is controlled by the DBMS.
 Manipulating
 Manipulating a database includes such functions
as querying the database to retrieve specific
data, updating the database to reflect changes,
and generating reports from the data.
8/18/2019 IT Department @ SIBA Campus 7
Why Study DBs?

 Very widely used.


 Part of many software solutions.
 DB expertise is a career asset.
 Interesting:
– Mix of many different requirements
– Mix of many different methodologies
– Real world application

$$!!
8/18/2019 IT Department @ SIBA Campus 8
JOB Market

8/18/2019 IT Department @ SIBA Campus 9


Types of Databases and Database
Applications
 Numeric and Textual Databases
 Banks
 Multimedia Databases
 Amazon. Com
 Geographic Information Systems (GIS)
 Data Warehouses

8/18/2019 IT Department @ SIBA Campus 10


Examples

Today, DBMSs are an essential part of


any Enterprise Information System

 University Database
 Credit Card Processing Systems
 Airline Reservation Systems
 Banking System
Databases touch all aspects of our lives

8/18/2019 IT Department @ SIBA Campus 11


Example: University DB

 University database maintaining


information concerning:
 Students,
 Courses, and
 Grades
 …

8/18/2019 IT Department @ SIBA Campus 12


An example of a DB
Stores students and their grades of followed courses
STUDENT Name StudentNumber Class Major
Smith 17 1 CS
Brown 8 2 CS
COURSE CourseName CourseNumber CreditHouse Department
Intro to Computer Science CS 1310 4 CS
Data Structures CS 3320 4 CS
Discrete Mathematics MATH 2410 3 MATH

Database CS 3380 3 CS

SECTION Sectionaldentifier CourseNumber Semester Year Instructor


85 MATH 2410 Fall 98 King
92 CS 1310 Fall 98 Anderson
102 CS 3320 Spring 99 Knuth
112 MATH 2410 Fall 99 Chang
119 CS 1310 Fall 99 Anderson
135 CS 3380 Fall 99 Stone
GRADE_REPORT StudentNumber Sectionaldentifier Grade
17 112 B
17 119 C
8 85 A
8 92 A
8 102 B
8 135 A
PREREQUISITE CourseNumber PrerequisiteNumber
CS 3380 CS 3320
8/18/2019 IT Department @ SIBA Campus
CS 3380 MATH 2410 13
CS 3320 CS 1310
Example: University DB (contd…)

 It shows the database structure and a few sample


data.
 It is organized as five files.
 The STUDENT file – data on each student,
 The COURSE file – data on each course,
 The SECTION file – data on each section of a
course,
 The GRADE_REPORT file – data on grades that
students receive in the various sections they have
completed, and
 The PREREQUISITE file – data on prerequisite of
each course.
8/18/2019 IT Department @ SIBA Campus 14
Options

 Manual Processing
 Time Consuming
 Does not support large volumes
of data
 File based Processing
Traditional File System provided by the
Operating System is insufficient to meet the
requirements of enterprise applications
 Database Processing
8/18/2019 IT Department @ SIBA Campus 15
ID 001
Name Anne
File Based Processing Address Perth
TelNo 747374
Data Duplication Marks 75

Data File Handling


Entry Routines Student System Files
& File Definitions
Report ID 001
Name Anne
s
Address Perth
TelNo 747374
Books-Loan 5
Data File Handling
Entry Routines
& File Definitions
Report
s
Library System Files
8/18/2019 IT Department @ SIBA Campus 16
File Based Processing
ID 001
Name Anne
Change request Address Perth
TelNo 747374
Marks 75

Data File Handling


Entry Routines Student System Files
& File Definitions
Report ID 001
Name Anne
s
Address Perth
TelNo 747374
Books-Loan 5
Data File Handling
Entry Routines
& File Definitions
Report
s
Library System Files
8/18/2019 IT Department @ SIBA Campus 17
File Based Processing
ID
Name
001
Anne
Change request Address Sydney
TelNo 624875
Marks 75

Data File Handling


Entry Routines Student System Files
& File Definitions
Report ID 001
Name Anne
s
Address Perth
TelNo 747374
Books-Loan 5
Data File Handling
Entry Routines
& File Definitions
Report
s
Library System Files
Inconsistent Data
8/18/2019 IT Department @ SIBA Campus 18
Limitations of File Based Systems

 Data Inconsistency
 Duplication of Data
 Security – Only password security

 How do we resolve these problems?

8/18/2019 IT Department @ SIBA Campus 19


Database Processing
Change Request
stno Name address
001 Jay Perth
Data Entry & …………….
Reports

Students Application
Programs
DBMS

Data Entry & Database


Reports

Library App. Programs

8/18/2019 IT Department @ SIBA Campus 20


Database Processing
Change Request
stno Name address
001 Jay Sydney
Data Entry & …………….
Reports

Students Application
Programs
DBMS

Data Entry & Database


Reports

Library App. Programs

8/18/2019 IT Department @ SIBA Campus 21


Advantages of using a DBMS

 Data independence
 Efficient data access
 Data integrity and security
 Data administration
 Concurrent access, recovery from
crashes
 Reduced application development
time
8/18/2019 IT Department @ SIBA Campus 22
Data independence
 Application programs are independent of data
representation and storage details.
 The structure of data files is stored in the DBMS
catalog separately from the access programs.
 E.g. a file access program may be written in
such a way that it can access only STUDENT
records of the structure.

8/18/2019 IT Department @ SIBA Campus 23


Efficient data access

 DBMS utilises sophisticated techniques to store


and retrieve data efficiently, including support for
very large files, index structures and query
optimisation.

 Storage methods can be improved without


changing the application programs.

8/18/2019 IT Department @ SIBA Campus 24


Data integrity and security

 DBMS can enforce integrity constraints on


the data.
e.g., checking salary increase against dept budget

 Access controls govern what data is visible


to different class of users.

8/18/2019 IT Department @ SIBA Campus 25


Data administration

 Centralising administration of data shared


among many users.
• data managed by professionals

 Organise data to,


• meet user needs
• minimise redundancy

 Fine tuning of storage for efficient retrieval.


8/18/2019 IT Department @ SIBA Campus 26
Concurrent access and Crash
recovery

 Concurrent accesses are scheduled by


DBMS.
- users can think of the data as being accessed by one
user at a time.

 DBMS protects users from the effects of


system failure.

8/18/2019 IT Department @ SIBA Campus 27


Reduced application development
time
 DBMS supports many functions common
to applications that access the database
 High-level interfaces to data also
facilitate quick development of
applications
 These applications are likely to be more
robust than applications developed from
scratch because many important tasks
are handled by DBMS instead of being
implemented by the application
8/18/2019 IT Department @ SIBA Campus 28
When not to use a DBMS

With all its advantages, in some


applications using DBMS is not the
desirable solution. In many such
cases, files (provided by the OS) is
used.

8/18/2019 IT Department @ SIBA Campus 29


When NOT to use a DBMS

 High initial investment (DBMS is an


expensive software package)
 Applications use small amounts of data

 Lack of resources (disk space, memory,


etc.) to support a database
 Single-user applications
 Overhead for flexible querying, security,
concurrent access & crash recovery is
not required
8/18/2019 IT Department @ SIBA Campus 30
What do we store in a
Database?

 Collection of data central to some


enterprise

 Essential to operation of enterprise

 Historical data can guide enterprise


strategy
 Of interest to other enterprises

8/18/2019 IT Department @ SIBA Campus 31


Describing & Storing Data in a
DBMS
 A data model is a collection of
high-level data description
constructs used to model the
application domain
 Data model hides the low-level
storage details
 Most commercial database systems
are based on the relational data
model
8/18/2019 IT Department @ SIBA Campus 32
Describing & Storing Data in a
DBMS (contd…)

 However, it is easier to use a


semantic data model to model an
application domain. A well-known
semantic data model is the Entity
Relationship (ER) Model

8/18/2019 IT Department @ SIBA Campus 33


Describing & Storing Data in a
DBMS (contd)
 In relational data model, the main construct is a
relation.
 A relation has fields that belong to it which contain
the name & data type of each field

 A description of data in terms of a data model is


called the schema.

 Every relation has a schema, which describes the name of


the relation, name of each attribute (field or column), and
the type of each column.
e.g.
Students(sid: string, name: string, login: string,
age: integer, gpa: real)
8/18/2019 IT Department @ SIBA Campus 34
Describing & Storing Data in a
DBMS (contd)
 In addition to relational data model…
 Hierarchical model,
 Network model,
 Object oriented model, and
 Object relational model.

8/18/2019 IT Department @ SIBA Campus 35


Levels of Abstraction in a DBMS
 Proposed to support:

 Program-data independence
 Support of multiple views of the data

8/18/2019 IT Department @ SIBA Campus 36


Levels of Abstraction in a
DBMS(contd)
DBMS is described at three levels of
abstraction:
 External Schema View 1 View 2 View 3
 many views describe how
 users see the data

 Conceptual Schema Conceptual Schema


 defines logical structure
Physical Schema
 Physical Schema
 describes the files and indexes used

Note: DISK
Information about the schemas is stored
in the system catalog IT Department @ SIBA Campus
8/18/2019 37
Levels of Abstraction in a
DBMS(contd)
 Conceptual schema

 describes the stored data in terms of the


data model of the DBMS

 in a relational DBMS, the conceptual


schema describes all relations that are
stored in the database

8/18/2019 IT Department @ SIBA Campus 38


Levels of Abstraction in a
DBMS(contd)
 Physical schema
 describe storage details
 summarizes how the relations described
in the conceptual schema are actually
stored on secondary storage devices
such as disks and tapes
 decide what file organizations used to
store the relations
 create indexes to speed up data retrieval
operations

8/18/2019 IT Department @ SIBA Campus 39


Levels of Abstraction in a
DBMS(contd)
 External schemas
 allow data access to be customized (and
authorized) at the level of individual
users or groups of users
 any given database has exactly one
conceptual schema and one physical
schema because it has just one set of
stored relations, but it may have several
external schemas

8/18/2019 IT Department @ SIBA Campus 40


DBMS Architecture
 The architecture of DBMS depends on
the computer system on which it
runs. For example, in a client-server
DBMS architecture, the database
systems at server machine can run
several requests made by client
machine. We will understand this
communication with the help of
diagrams.
8/18/2019 IT Department @ SIBA Campus 41
Types of DBMS Architecture
 1. Single tier architecture
2. Two tier architecture
3. Three tier architecture

8/18/2019 IT Department @ SIBA Campus 42


Single tier architecture
 in this type of architecture, the database is readily
available on the client machine, any request made by
client doesn’t require a network connection to perform
the action on the database.
 For example, lets say you want to fetch the records of
employee from the database and the database is
available on your computer system, so the request to
fetch employee details will be done by your computer
and the records will be fetched from the database by
your computer as well. This type of system is generally
referred as local database system.

8/18/2019 IT Department @ SIBA Campus 43


Two tier architecture
 In two-tier architecture, the Database system is
present at the server machine and the DBMS
application is present at the client machine, these
two machines are connected with each other
through a reliable network as shown in the above
diagram.
 Whenever client machine makes a request to access
the database present at server using a query
language like sql, the server perform the request on
the database and returns the result back to the
client. The application connection interface such as
JDBC, ODBC are used for the interaction between
server and client.

8/18/2019 IT Department @ SIBA Campus 44


Three tier architecture
 In three-tier architecture, another layer is
present between the client machine and
server machine. In this architecture, the
client application doesn’t communicate
directly with the database systems present
at the server machine, rather the client
application communicates with server
application and the server application
internally communicates with the database
system present at the server.

8/18/2019 IT Department @ SIBA Campus 45


Data Independence

One of the main advantages of DBMS.

The three-schema architecture provides


the concept of data independence,
upper-levels are unaffected by changes
to lower-levels.

Two types:
Logical data independence
Physical data independence
8/18/2019 IT Department @ SIBA Campus 46
Logical Data Independence

The ability to modify the conceptual schema


without having alteration in external schemas
or application programs.

Eg. addition or deletion of fresh entities,


attributes or relationships
should be possible
without having alteration to existing external
schemas or having to rewrite application
programs.
8/18/2019 IT Department @ SIBA Campus 47
Physical Data Independence

The ability to modify the inner schema


without having alteration to the conceptual
schemas.

Eg. Using new storage devices.


Switching from one access method to
another.
Modifying indexes.

should be possible without having to change


the conceptualITschema.
8/18/2019 Department @ SIBA Campus 48
People who deal with databases
 End users- uses applications written by
database application programmers
 Application Programmers – develop
packages that facilitates data access for
end users.
 Database Administrators – undertake
the task of designing and maintaining
the database.
 Design schemas, security & authorisation, tuning etc

8/18/2019 IT Department @ SIBA Campus 49


Your Turn !!
Categorize each of the following into
database administration tasks of
design, security/integrity , and
performance.
 Reducing order entry response time to
2 seconds
 Re-issuing passwords for every user
 Directly relating every sale to the sales
representative who made the sale.
8/18/2019 IT Department @ SIBA Campus 50
How does a DBMS do all this?

 DBMS is a complex
software package

 The major components of


a DBMS are shown

8/18/2019 IT Department @ SIBA Campus 51


How does a DBMS do all this?
(contd.)
 Query Evaluation Module
 Transaction Manager
 Lock Manager
 Recovery Manager
 Files and Access Methods
 Buffer Manager
 Disk Space Manager
 Index Files
 Data Files
 System Catalogs
8/18/2019 IT Department @ SIBA Campus 52
Summary

 Characteristics and problems of file-based systems


 The major components of a DBMS
 The advantages and disadvantages of a DBMS
 DBMS users

8/18/2019 IT Department @ SIBA Campus 53

S-ar putea să vă placă și