Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Unit-1 DBMS

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 82

DBMS (MS 235)

Unit-1
Purpose,
Advantages
and
Disadvantages of DBMS
Schemas and Instances
DBMS
Architecture
and
Data
Independence
Data Models
Types of DBMS Hierarchical, Network,
Relational, Object-Oriented and Object
Relational

What is Database and


Database Management
System

Database & DBMS


Database is a collection of
related data and data is a
collection of facts and figures
that can be processed to
produce information.
A Database Management
System stores data in such a
way that it becomes easier to
retrieve, manipulate, and
produce information.

Database & DBMS


A Database Management
System (DBMS) is a
software package designed
to store and manage
databases.
Examples of DBMS are:Oracle,
MS-Access,
MySQL,DB2,MS SQL Server.

Data Management :: Key Concepts


The Representation of an Individual
Fact or Element

A Collection of one or more data


elements

Grouping of one or more data


records

Group of Files: All of the Data


necessary to Produce Information

Data

Record
s

Files

Database

Data Management Approaches


Database
Manual
On Papers, Files,
Diaries etc.

Electronically
Computer

Mobile Phones

Office Automation
Packages
MS Office,
(MS Excel, MS Word etc.)`
DBMS
(Oracle, MS SQL)
7

CODDS 12 RULES

Rule
Rule
Rule
Rule
Rule
Rule
Rule
Rule
Rule
Rule
Rule
Rule

1: Information Rule
2: Guaranteed Access Rule
3: Systematic Treatment of NULL Values
4: Active Online Catalog
5: Comprehensive Data Sub-Language Rule
6: View Updating Rule
7: High-Level Insert, Update, and Delete Rule
8: Physical Data Independence
9: Logical Data Independence
10: Integrity Independence
11: Distribution Independence
12: Non-Subversion Rule

DBMS v/s RDBMS


DBMS

RDBMS

The relationship between two


table or files are maintained
programmatically

Relationship are defined at the


time of table creation

It does not support Client/Server


Architecture

It supports the Client/Server


Architecture

It does not support distributed


database

It supports distributed database

There is less security of data

High level of security is


maintained

Each table is given extension in


DBMS

Many tables are grouped in one


database.

It satisfies less than 7 to 8 Codd


rules

It satisfies more than 7 to 8 Codd


rules.

Ex.Foxpro,Ms Access

Ex: Oracle, Microsoft SQL Server,


MySQL,PostgreSQL

Naming Conventions

Why Use a RDBMS?


Data independence and efficient
access.
Reduced application development
time.
Data integrity and security.
Uniform data administration.
Concurrent access, recovery from
crashes.

RDBMS support following


functions
Data storage ,retrieval & updates.
User Accessible catalog.
Transaction support.
Concurrency control.
Recovery services.
Authorization services .
Integrity services
Data independency

11

Database Applications
Banking: all transactions
Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Manufacturing: production, inventory, orders,
supply chain
Human resources: employee records,
salaries, tax deductions
Databases touch all aspects of our lives

Characteristics of RDBMS
Real-world entity
Relation-based tables
Isolation of data and application
Less redundancy
Consistency
Query Language

Characteristics of RDBMS
ACID Properties
Multiuser and
Concurrent Access
Multiple views
Security

File System approach

Database

DBMS approach

The main difference between


DBMS and file processing system
Data redundancy and inconsistency
Difficulty in accessing data
Data isolation
Integrity problems
Atomicity problems
Concurrent-access anomalies
Security problem

Integrity constraints (e.g.


account balance > 0) become
part of program code
Hard to add new constraints or
change existing

Multiple files and formats

Need to write a new program to


carry out each new task

Multiple file formats, duplication


of information in different files

Integrity
problems
Data isolation
Data
redundancy
and
inconsistency
Difficulty in
accessing
data

Drawbacks of using file systems to store data

Database systems offer solutions to all


the above problems
Less Security

Concurrent accessed needed for


performance
Uncontrolled concurrent accesses can
lead to inconsistencies
E.g. two people reading a balance and
updating it at the same time
Failures may leave database in an
inconsistent state with partial updates
carried out
E.g. transfer of funds from one account
to another should either complete or not
happen at all

Security
problems very
Concurrent
access by
multiple users
Atomicity of
updates

Drawbacks of using file systems to


store data

ADVANTAGE OF DBMS
Controlling redundancy
Providing consistence
Providing multiple user interface
Enforcing integrity constraints
Restricting unauthorized access
Providing multiple interface
DBMS support data independence
DBMS providing data security
Better control:- centralized approach
Reduced maintenance
Enforcement of standards
Better service to the users.

DBMS Users

DBMS users

Function of DBA
Defining the schema .
Liaising with users.
Defining security & integrity checks
Defining backup /recovery procedures.
Monitoring performance .
Granting of authorization for data
access
23

DATA MODELS

Data modeling concept


DBMS is used to store information
regarding an organization. In order to
represent this information some kind
of mapping or modeling is required.
The analysis of data objects and
their relationships to other objects is
known as data modeling.

Importance of Data
Models
Data models
Representations, usually graphical, of
complex real-world data structures
Facilitate interaction among the
designer, the applications programmer
and the end user

It hides extra details & represent


only the essential one.
Data model organizes data for
various users

Relationsh
ip

Describes an association among entities


One-to-one (1:1) relationship
One-to-many (1:M) relationship
Many-to-many (M:N or M:M) relationship

Constraint

A restriction placed on
the data

Characteristic of an entity

Anything about which data will


be collected/stored

Attribute
Entity

Data Model Basic Building


Blocks

DATA MODELS
1) Entity-Relationship Model
ER Model is based on:
a)Entities and their attributes
b)Relationships among entities.

The logical association among entities is called


relationship.

Mapping cardinalities

One to one
One to many
Many to many

1-Database Management
System

One to
One
Associati
on

One to
Many
Associati
on

Many to
Many
Associat
ion

DATABASE MANAGEMENT
SYSTEM
1-ONE TO ONE ASSOCIATION

STUDENT

ROLL NO

DATABASE MANAGEMENT
SYSTEM
2-ONE TO MANY ASSOCIATION
Student

Departm
ent

Student

Student

DATABASE MANAGEMENT
SYSTEM
3-MANY TO MANY ASSOCIATION
BOOK
STORE

BOOKS

BOOK
STORE

BOOKS

BOOK
STORE

BOOKS

2) Relational Model

The main highlights of


Relational model are:
Data is stored in tables called
relations.
Relations can be normalized.
In normalized relations, values saved
are atomic values.
Each row in a relation contains a
unique value.
Each column in a relation contains
values from a same domain.

5-Object
Relational

4-Object
Oriented
Model

312-Network Hierarchic
Relational
Model
Model
al Model

Types of DBMS Models

The Evolution of Data


Models

We will look briefly at each Model Type

The Hierarchical Model

Developed in 1970s to manage large amounts of data for


complex manufacturing projects
Logical structure represented as an upside-down tree
Hierarchical structure contains levels or segments
Depicts a set of one-to-many (1:M) relationships
Between a parent and its children segments
Each parent can have many children
each child has only one parent

Hierarchical Model
Advantages
Many features form the foundation for current
data models
Generated a large installed base of
programmers
Who developed solid business applications

Disadvantages

Complex to implement
Difficult to manage
Lacks structural independence
Implementation limitations
Lack of standards (Company vs Industry or

The Network Model


Developed in the late 1960s by the
data base task group of the
conference on data system
language(DBTG/CODASYL)
uses two different data structure to
represent entities & relationship
between entities :- Record type, Set
type
Record type:- represent entity
Set type:- Relationship bt/wn record
type

The Network Model

Resembles hierarchical model


Difference child can have multiple parents

Collection of records in 1:M relationships


Set Relationship of at least two record types
Owner Equivalent to the hierarchical models parent
Member Equivalent to the hierarchical models child

The Network Model


Department

Owner
record type

Dept_emp
set type

Employee

Member
record
type

Network Model
In this model restriction of child
having 1 parent does not exist. every
child can have more than 1 parent
and every parent can have more
than 1 child.
This model is very flexible .it consists
of records and links
In this mapping is similar to
hierarchical model, but mapping
between parent to child is very

Network Model
Advantages
Represents complex data relationships better than Hierarchical
Model
Improved database performance
Impose a database industry standard
Conference on Data Systems Languages (CODASYL)
Database Task Group (DBTG)

Disadvantages
Too bulky
Lack of ad hoc query capability
Put heavy pressure on programmers

Any structural change in the database could produce mess in all


application programs that drew data from the database

The Relational Model

Conceptually simple Linked Tables


Developed by E. F. Codd (IBM 1970 )
More flexible than Hierarchical,Network
model

Relational Model Tables

Also called relations


Matrix of row and column intersections
Stores a collection of similar entities
Resembles a file or spreadsheet

Purely logical structure


How data are physically stored is of no concern to the
user or the designer
The source of a real database revolution

Relational Model Relational


Diagram
Representation of
relational databases
Entities (Tables)
Attributes within
those entities (Fields)
Relationships between
those entities (Links)

Relational Model RDBMS


Relational Database Management System
All the system components
User interface
Tables
Method of querying the tables

Performs same basic functions as


Hierarchical and
Network DBMS models
Plus many other functions

Most important hides the complexities of


the relational model from the user

The Relational Model SQL


Structured Query Language (SQL)
Allows ad hoc queries questions of the data

User can specify what must be done


without specifying how it must be done
Dominance due in great part to its powerful
and flexible query language
SQL-based relational database application:
User interface
A set of tables stored in the database
SQL engine

What is Object-Oriented Data


Modeling?

Centers around objects and classes


Involves inheritance
Encapsulates both data and behavior
Benefits of Object-Oriented Modeling
Ability to tackle challenging problems
Improved communication between users,
analysts, designers, and programmers
Increased consistency in analysis, design, and
programming
Explicit representation of commonality among
system components
System robustness
Reusability of analysis, design, and programming
results

The Object-Oriented Data Model

When you integrate DB capabilities with OOPs language


capabilities the result is OODBMS.

A core object-oriented data model consists of the following


basic object-oriented concepts:

(1)Object and object identifier: Any real world entity is


uniformly modeled as an object (associated with a unique
id: used to pinpoint an object to retrieve).

(2) Attributes and methods: every object has a state


(the set of values for the attributes of the object) and a
behavior (the set of methods - program code - which
operate on the state of the object). The state and behavior
encapsulated in an object are accessed or invoked from
outside the object only through explicit message passing.

(3) class:

A means of grouping all the objects which


share the same set of attributes and methods. An object
must belong to only one class as an instance of that class
(instance-of relationship). A class is similar to an abstract
data type. A class may also be primitive (no attributes),
e.g., integer, string, Boolean.

(4) Class hierarchy and inheritance:

Derive a new class (subclass) from an existing class


(superclass). The subclass inherits all the attributes and
methods of the existing class and may have additional
attributes and methods. single inheritance (class hierarchy)
vs. multiple inheritance (class lattice).

OO vs. EER Data Modeling


Object
Oriented
Class

EER
Entity type

Object

Entity instance

Association

Relationship

Inheritance of
attributes
Inheritance of behavior

Inheritance of attributes
No representation of
behavior

Object-oriented modeling is typically represented


using the Unified Modeling Language (UML)

Classes and Objects


Class: An entity that has a well-defined
role in the application domain, as well
as state, behavior, and identity
Tangible: person, place or thing
Concept or Event: department,
performance, marriage, registration

Object: a particular instance of a class

Objects exhibit BEHAVIOR as well as attributes


Different from entities

State, Behavior, Identity


State: attribute types and values
Behavior: how an object acts and
reacts
Behavior is expressed through
operations that can be performed on it

Identity: every object has a unique


identity, even if all of its attribute
values are the same

Figure 14-2 UML class and object


diagram
a) Class diagram showing two
classes

Class diagram shows the static structure of an


object-oriented model: object classes, internal
structure, relationships.

Figure 14-2 UML class and object diagram


(cont.)
b) Object diagram with two instances

Object diagram shows instances that are


compatible with a given class diagram.

DATA SCHEMAS

Figure :-Schema diagram for UNIVERSITY database

schema construct

Known data:
name of record types, data items
2-4a

59

Figure :-UNIVERSITY Database

2-4

60

Defines DBMS schema at


three levels

The Three-schema architecture

62

Example: University Database

DATABASE SCHEMA

Database Schema vs
Instance

Instance of Students Relation


Students( sid: string, name: string, login: string,
age: integer, gpa: real )
sid
53666
53688
53650

name
Jones
Smith
Smith

login
age gpa
jones@cs 18 3.4
smith@ee 18 3.2
smith@math19 3.8

3-level architecture of DBMS


Many external schema
single conceptual(logical)
schema and physical
schema.

External schema describe


how users see the data.

Conceptual schema defines


logical structure
Physical schema describes
the files and indexes used.

External
Schema 1

External
Schema
2

External
Schema 3

Conceptual Schema
Physical Schema

3-level architecture of DBMS


. View level: A way to hide: (a) details of data types and (b)
information (such as an employees salary) for security purposes
Logical level: describes what data stored in database, and the
relationships among the data.
type customer= record
customer_id: string;
customer_name: string;
customer_street: string;
customer_city: integer;
end
Physical level: describes how a record (e.g., customer) is stored

ARCHITECTURE OF DBMS- 3-tier


Architecture

DATA INDEPENDENCE

Elements of a DBMS

Elements of DBMS

STORAGE SYSTEM
H
i
g
h
C
a
p
a
c
it
y

H
i
g
h
S
p
e
e
d

RAID
RAID stands for Redundant Array
of Independent Disks, which is a
technology to connect multiple
secondary storage devices and use
them as a single storage media.

RAID-0
RAID levels define the use of disk
arrays.

RAID-1

RAID-2

RAID-3

RAID-4

RAID-5

RAID-6

You might also like