Sei sulla pagina 1di 66

DATABASE MANAGEMENT SYSTEM

DATA
INFORMATION
DATABASE
ORGANIZATION AS AN INFORMATION SYSTEM
SOURCES/QUALITIES OF INFO SYSTEM
WHAT IS DATABASE
HIERARCHY OF DATABASE
DATABASE Vs. FILE SYSTEM
DATA MODELS
DATABASE MANAGEMENT SYSTEM
DATABASE DESIGN

DATA
DATA = GREEK WORD DATUM
MEANS
Raw facts and figures
LIKE
Number, event, letter, transaction
By which we cannot make any conclusion
OR
Meaningless

INFORMATION
PROCESSED DATA WHICH IS
MEANINGFULL
User can take the decision based on information

Data
Internal

Processing

OR

Extertnal

Information

Organization as an information
system
Marketing

Sales

management
Planning

Production

Control

Corporate
Database

Accounting

Material

A/C Receivable A/C Payable

raw
Manufacturing

Scheduling

Production

finished

Sources/Qualities of Information
Internal & External
The value of information
Information for Managers-Controlling,
Operation, Strategic, Tactical.
Completeness
Accurate
Timeliness
Speed

What is DATABASE

A database is a logically coherent


collection of data with some inherent
meaning. A random assortment of
data cannot correctly be referred to
as a database
A database is collection of related
information, which is designed, built,
and populated with specific purpose

Hierarchy of DATABASE

Bit
Byte
Field
Record
Table
Database

0,1
10001101 (8Bits)
Collection of Bytes
Collection of Fields
Collection of Records
Collection of tables

Example of a simple database


Header Row

Field

E_no

E_name

E_age E_dept

E_add

E101

Amit

25

Sales

Gurgaon

E102

Sunil

32

Marketing

Delhi

E103

Radha

27

Accounts

Chennai

E104

Vibha

34

Sales

Delhi

E105

Sunita

30

Marketing

Mumbai

E_no

Basic

TA

DA

PF

E101

5000

500

250

1000

E102

7000

700

350

1400

E103

5500

550

225

1100

E104

8000

800

400

1600

Emp_payment E105

7500

750

375

1500

Records

Emp_personnel

Table

Table

D
A
T
A
B
A
S
E

Examples of Database

Organization
Bank
Hospital
University
Government Organization
Manufacturing Company

Why Database

Compactness
Speed
Controlled Redundancy
Inconsistency can be avoided
Database can be shared
Security
Integrity

Database Vs File System


1. In the database approach, a
single repository of data is
maintained that is defined
once then accessed by
various users

1. Redundancy not controlled


2.

Data Accessing problems

3. Not Secured
2. Self-describing of a DB
4. Integrity
3. Insulation between
programs and data
4. Support of multiple views
of the data
5.

Sharing of data and


multiuser transaction
processing

5. Doesnt support multiple


users
6. unable to handle New
situation like over drafting

Data Models
Collection of Conceptual tools for
describing
1.
2.
3.
4.

Data
Data relationships
Constraints
Data semantics

Types of Data Models

Record based model


1. Relation model
2. Network Model
3. Hierarchical Model

Data Model
Object Oriented Model
1. E-R Model
2. Object oriented
3. Semantic

Physical Model

Relational Model
1. A relational database
allows the definition of
data structures,
storage and retrieval
operations,
integrity constraints.
2. In such a database the
data and relations
between
them are organized in
tables.
3. A table is a collection of
records and each
record in

Network Model
1. Data are
represented as
collection of
records.
2. Relationships
are represented as
Links.
3. Each record is a
collection of fields
which can be

Hierarchical Model
1. A hierarchical database consists
of a collection of records which
are connected to one another
through links.
2. A record is a collection of fields,
each of which contains only
one data value.
3. A link is an association between
precisely two records.
4. The hierarchical model differs
from the network model in that
the records are organized as
collections of trees rather than
as arbitrary graphs.
5. A parent may have an arrow
pointing
to a child, but a child must have

Entity / Attribute
Entity=A person, Place, Thing or Event
Ex: Teacher, Organization, Employee

Attribute=Information to describe the entity


Eno

Ename

Edept
Employee

Eage

Eage

E-R Model
1. Based on perception of
the real world.
2. Collection of basic
object called as entity
3. And relationships
among the entity.
4. Rectangles=entity
5. Ellipses=attributes
6. Diamond=relation

Object Oriented Model


1. Collection of classes and Objects
2. Class=collection of same type of objects
3. Objects=have many attribute
Ex: Fruit, Furniture, Stationary
Fruits=yellow, pulpy, sweet

Semantic Model
Include extended relation between tables
Richer facilities for capturing the data
objects
Maintains integrity of the objects

Physical Model
Used to describe data at lowest level
Where and how to store the data
Ex: Unifying Model &
Frame memory Model

DATABASE MANAGEMENT SYSTEMS

What is a Database Management


System?
A DBMS is a collection of programs
which
1. Create database (Creation)
2. provide management of databases (Access)
3. control access to data (Security)
4. contain a query language to retrieve
information easily (Access)
5. Computerised record keeping system (Data

Schema Definition
The description of Database is called as
schema.
Specified during database design and
expected to change easily.
Ex: Employee
Emp_ID

Emp_Name

Add

City

pincode

Internal schema
Internal schema = describe the storage
structure of the DB.
Uses physical data model that describe
storage and access path of the data.
Ex: stored item : length 40 bytes
type: number, offset=0, index=1
name: character, offset=6
price: number, offset=20

Conceptual schema
Describe the structure of the DB
Concentrates on describing entities, data
type, relationships, user operation,
constraints.
Represented in the form of data model ex.
E-R model

External Schema or view level


Also called as view level
Describe the part of DB that particular user
or group if user is interested.
Hides the details from other user
Ex. Show emp_name, add, city, pincode;
hide Salary or Age

Database Architecture

ANSISPARC
ThreeLevelArchitecture

Data independence
Capacity to change the schema at one level
of DB system without having to change the
schema at next higher level

Logical & Physical


data independence
capacity to change the conceptual schema
without having to change the external
schema or application program.
capacity to change the physical schema
without having to change the conceptual
schema.

Phases of database design


Functional requirement
Functional
analysis
High level transaction analysis
Database independent
Database specific

Application program
design
Transaction
implementation
Application program

Mini world
Requirement & collection
analysis
Data requirement
Conceptual
design
Conceptual schema
logical
design
logical schema
physical
design
internal schema

DATABASE MANAGEMENT SYSTEMS

Database Design
It is important to design the database in
such a way that:
A specific item can be reached easily
(maximum guarantee that the desired record
will be
reached)

The database can respond to the users


different questions easily
(necessary relationships are provided)

DATABASE MANAGEMENT SYSTEMS

The database occupies minimum storage


space
(choosing data types and how to express a
certain
concept is important)

The database contains no unnecessary


data
(storing the gross salary is enough, the net
salary
can be calculated from the gross salary)

Database languages
DDL=data definition language
Ex: create, alter, drop, grant, revoke
DML=data manipulation language
Ex: Select, update, deletion, insertion
Insertion, modification, deletion and access
TCL=transection control language
Ex: commit, rollback, locktable
VDL=view definition language
Ex: create view
View=window through user can view the database

E-R Modeling
1976 proposed by Peter Chen
ER diagram is widely used in database design
Represent conceptual level of a database system
Describe things and their relationships in high level

Entity

Notations

Notations

Entity
Entity
An entity is an object that exists and is
distinguishable from other objects.
Example: Employee, customer, Student, event,
plant

Notation: rectangle

employee

Entity set
1. An entity set is a set of entities of the same
type that share the same properties.
2. An abstraction of similar things,
3. An entity set contains many entities
e.g. Employee, Customer, students
customer_id
customer_name
Customer_add
Customer_city
Customer_pincode

Employee_id
employee_name
employee_add
employee_city
employee_pincode
Student_id
student_name
student_add
student_city
student_pincode

Weak Entity Set Notations


1. Double rectangles for weak entity set
2. Double diamond for weak entity relationship
3. Cannot indentify without owner
4. So week entity always has total participation
means full
dependency
Ex: father-> children
all have different name
Notation
Dependent
DOB

40

Attributes
Attributes: common properties of the
entities in a entity sets which describe
the entity
Single value attribute: exactly one value
for particular attribute
Ex: age, telephone no.
Multi valued attribute: having sets of
values
Ex: one teacher teaches =multiple

Stored or Derived attribute :


Stored attribute: whose value can be
used to derive the value of some
other attribute
Ex: DOB, DOJ
Derived attribute: whose value can
be derived from stored attribute
Ex: Age, Experience

Simple Vs. composite attribute


Simple attribute: attribute that is not
divisible
Ex: Sex,
Composite attribute: attribute that is
divisible
Ex: Address street add,
city
state

Key attribute
key attribute: has unique value for
each and every entity
Value used to identify the entity
Ex: Emp_No, St_No, Item_no,
customer_no
Candidate key: if one table
Has more then one key attributes
Ex:Vehicle_ID and registration_no

E-R Diagram With Composite, Multivalued,


Derived Attributes

Relationships
Relationship specify the
relations among entities from
two or more entity sets

Cardinality Ratio
The degree of a relationship = the number
of entity sets that participate in the
relationship
1. One to one relationship(1:1)
2. One to many relationships (1:M)
3. Many to one relationship (M:1)
4. Many to many relationship (M:M)

One to One relationship


Binary relation type
We express cardinality constraints by
drawing either a directed line
Ex; one department can be manage by one
one manager
Each dept = one manager
Dept
Manager

One to Many
One dept = many employees
Dept1
emp1

emp2

emp3

emp4

In the one-to-many relationship a loan is associated with


at most one customer via borrower,

Many to One
One Teacher = many students
student1

student2

student3

student3

teacher
In the many to One relationship a customer is
associated with loan via borrower,

Many to Many
Many students = Many projects
student1

project1

student2

project2

student3

project3

student4

project4

A customer is associated with several (possibly 0) loans


via borrower
A loan is associated with several (possibly 0) customers
via borrower

Relationship type
binary & Turnery Relation type
Relationship type
Ex; teacher-student relation=taught
Emp-Dept
relation=works for
Doctor-patient relation=treatement
Relationship sets
Ex; teacher, employee, students, dept,
doctor patient
Relationship B/W 2 entities called as
binary type relationship

Binary relationship Example


e1
e2
e3
e4
e5
e6

.
.
.
.
.
.

Emp-Dept
E1,E3,E6 works for d1
E2, E4 works for d2
E5 works for d3

r1
r2
r3
r4
r5
r6

.
.
.
.
.
.

d1
d2
d3
d4
d5
d6

.
.
.
.
.
.

Relationship type=works for


Relationship degree: No. of
participating entity
2 entities emp & dept
relationship degree=2

Turnery relationship
s1
s2
.
p1
P2
p3

r1
r2
r3
r4
r5
r6

.
.
.
.
.
.

r7 .

j1
j2
j3
j4
j5
j6

If entities are more then 2 it is called as


turnery relationship.
Supplier s1, part p1, project j1 (3 entities)
Supply is the relationship type

.
.
.
.
.
.

Recursive/Constraints
Relationship type
Recursive = An entity participates more
then one relationships
Teacher mother, sister, wife
Constraints = organization has rule that
each emp works only for one project
2 types of relationship constraints
1. Cardinality Ratio
2. Participation
a) Total participation
b) Partial participation

Participation Constraints
Specifies whether the existence of an entity
depend on its being related to another entity
via the relationship type.
2 types
1. Total participation
2. Partial participation

Total Participation
When we require all entities to participate in the
relationship (total participation), we use double
lines to specify
OR
Every emp has to works_for dept, the total set
Every loan has to have
at least one customer

Partial participation
We do not expect every employee to
manage the department so participation of
employee in manages relationship type is
partial
Means that some or part of but not
necessarily all.

Specialization/Generalization

Specialization the process of defining


the subclass from the entity type.

Each subclass can be created on the basis


of special characteristics of the super
class entity
e1
e2
e3
e4
e5
e6

.
.
.
.
.
.

e1
e2
e3

engineer

e1
e2
e3

secretary

e1
e2
e3

technician

Extended E-R Features:


Specialization
Top-down design process; we designate sub groupings
within an entity set that are distinctive from other
entities in the set.
These sub groupings become lower-level entity sets that
have attributes or participate in relationships that do not
apply to the higher-level entity set.
Depicted by a triangle component labeled ISA (E.g.
customer is a person).
Attribute inheritance a lower-level entity set inherits
all the attributes and relationship participation of the
higher-level entity set to which it is linked.

Specialization Example

Generalization
1. Generalization reverse process many
entity
having similar type of features.
2. Identify the feature and generalize them in
one
into single super class
Ex; Employee, Car, Truck, person,
employee

ER DIAGRAM Entity Types are:


EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT

University ER Diagram
Degree
Name

StudentID

Birth date

SSN

DName

OfficeNumber

Major In

Department

Student

Sex

DCode

OfficePhone
College

Class

Minor In

Address
City

State

Zip

Offer

CName
Grade_Report
Letter Grade

CourseDesc
Instructor

Year

Course
CNumber

GPA
Credits
Numeric Grade

Section

SectionNumber

Belong_To

Semester

ER DIAGRAM FOR A BANK


DATABASE

An ER diagram for an AIRLINE database


schema.

Potrebbero piacerti anche