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

Sri Lanka Institute of Information Technology

Database Management
Systems I

Lecture 1
Objectives

BE ABLE TO IDENTIFY:
 Some common uses of databases
 Characteristics and problems of file-
based systems
 The meaning of the term database
 The major components of a DBMS
 The advantages and disadvantages
of a DBMS
 DBMS users
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?)
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.
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

$$!!
JOB Market
Types of Databases and Database
Applications
 Numeric and Textual Databases
 Banks
 Multimedia Databases
 Amazon. Com
 Geographic Information Systems (GIS)
 Data Warehouses
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
Example: University DB

 University database maintaining


information concerning:
 Students,
 Courses, and
 Grades
 …
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
CS 3380 MATH 2410
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.
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
File Based Processing
ID
Name
001
Anne
Address Perth
TelNo 747374
Marks 75

Data File Handling


Entry & Routines Student System Files
Report File Definitions
s ID 001
Name Anne
Address Perth
TelNo 747374
Books-Loan 5
Data File Handling
Entry Routines
& File Definitions
Report
s
Library System Files
Data Duplication
File Based Processing
ID
Name
001
Anne
Change request Address Perth
TelNo 747374
Marks 75

Data File Handling


Entry & Routines Student System Files
Report File Definitions
s ID 001
Name Anne
Address Perth
TelNo 747374
Books-Loan 5
Data File Handling
Entry Routines
& File Definitions
Report
s
Library System Files
File Based Processing
ID
Name
001
Anne
Change request Address Sydney
TelNo 624875
Marks 75

Data File Handling


Entry & Routines Student System Files
Report File Definitions
s ID 001
Name Anne
Address Perth
TelNo 747374
Books-Loan 5
Data File Handling
Entry Routines
& File Definitions
Report
s
Library System Files
Inconsistent Data
Limitations of File Based Systems

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

 How do we resolve these problems?


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

Application
Students Programs
DBMS

Data Entry & Database


Reports

Library App. Programs


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

Application
Students Programs
DBMS

Data Entry & Database


Reports

Library App. Programs


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


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.
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
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.
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
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
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
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
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)
Describing & Storing Data in a
DBMS (contd)
 In addition to relational data model…
 Hierarchical model,
 Network model,
 Object oriented model, and
 Object relational model.
Levels of Abstraction in a DBMS
 Proposed to support:

 Program-data independence
 Support of multiple views of the data
Levels of Abstraction in a
DBMS(contd)
DBMS is described at three levels of
abstraction:
 External Schema
 many views describe how
View 1 View 2 View 3
 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
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
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
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
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
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.
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 conceptual schema.
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

41
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.
How does a DBMS do all this?

 DBMS is a complex
software package

 The major components of


a DBMS are shown
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
Summary

 Characteristics and problems of file-based systems


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

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