0% found this document useful (0 votes)
3 views

Module 1

The document provides an introduction to database systems, including definitions, examples, and the importance of database management systems (DBMS). It discusses the advantages and disadvantages of DBMS, compares file-based systems with DBMS, and outlines different data models such as relational, hierarchical, and network models. Additionally, it explains the architecture of DBMS and the levels of abstraction within a database system.

Uploaded by

Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Module 1

The document provides an introduction to database systems, including definitions, examples, and the importance of database management systems (DBMS). It discusses the advantages and disadvantages of DBMS, compares file-based systems with DBMS, and outlines different data models such as relational, hierarchical, and network models. Additionally, it explains the architecture of DBMS and the levels of abstraction within a database system.

Uploaded by

Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 89

MODULE I

Introduction To Database
Systems and E-R Model

By Jismy Joseph
Overview of Database Systems
Database
• A Database is a collection of interrelated data.
• Designed to meet the information needs of
an organization.
• Eg. A university Database – It contains information
about students, faculty, courses, classroom etc. It
could also contains the information about which
student is studying which course.

By Jismy Joseph
Database Example
StudentDetails
StudentID SName Address PhoneNo Course

111 Jain 94, mill street 24000 1

112 David 67,Bridge street 21000 2

113 Prince 89, wc Road 32000 1

By Jismy Joseph
Database Example
CourseDetails
CourseID CName CFees Level

1 MBA 28000$ 9

2 MCA 30000$ 9

The above database contains two tables. One


table contains the information about the
student and the second table contains the
information about the course. This database
also contains the relationship between the
tables. By using this table we can find out
which students is doing which course.
By Jismy Joseph
Database System Applications
Database are widely used. Some applications are:

• Banking – For customer information, accounts, loans


and banking transactions etc.
• Airline – For reservation and schedule information
• Universities – For student information, Course registration
and grades.
• Sales – For customer, product and purchase
information.
• Human resources – For information about employees,
salaries, payroll taxes and benefits etc.
By Jismy Joseph
Database Management System(DBMS)
 “A Database management system (DBMS)
consists of a collection of interrelated data and a
set of programs to access that data”(Korth &
Silberschatz,1991,p.01).
 A software system that enables users to define,
create, maintain, and control access to the
database.
 (Database) application program: a computer
program that interacts with database by
issuing an appropriate request ( SQL statement)
to the DBMS. By Jismy Joseph
Database Management System (DBMS)

A software system that enables users to define, create, and


maintain the database and which provides controlled access
to this database

By Jismy Joseph
A Historical Perspective
• The first general purpose DBMS, designed
by Charles Bachman at General electric in
the early 1960, was called the Integrated Data
store.
• It formed the basis for the network data
model, which was standardized by the Conference
on Data Systems Language (CODASYL).
• In the late 1960, IBM developed the
Information Management system(IMS) DBMS.
• IMS formed the basis of Hierarchical data
Model.
By Jismy Joseph
• In 1970, Edgar Codd, at IBM’s San Jose
research Laboratory, Proposed a new data
representation framework called relational
data model.
• In the 1980, The SQL query language for
relational databases, developed as part of
IBM System r Projects.
• The SQL was standardized in the late 1980s.
• The current standard SQL:1999 was adopted
by the American National Standards Institute
(ANSI) and International Organization
for Standardization (ISO).
By Jismy Joseph
Advantages of a DBMS
Efficient Data Access – DBMS utilizes different
techniques to store and retrieve data efficiently.
Data Independence – Application program should
not, ideally, be exposed to details of data
representation and storage. It provides a abstract
view of data that hides such details.
Data Integrity & Security – DBMS can enforce
integrity constraints.
Concurrent Access and Crash Recovery – DBMS
schedule concurrent accesses to the data. i.e. data
being accessed by one user at the same time.
DBMS also protect the users from the effect of the
system failures. By Jismy Joseph
Advantages of Database
Reduced Application Development time – DBMS supports
important functions that are common to many applications
accessing data in the DBMS.
It avoid data redundancy - Data redundancy means storing
the same data more than once. For eg. In a banking
software, there is a possibility of storing customer details
(ie customer name and phone no..) in more than one
table(saving account, current account). DBMS helps us to
avoid data redundancy problems.
It avoid data inconsistency - Data redundancy may lead to
data inconsistency. For eg. The customer’s address is
contained in more than one table. If the customer’s address
is changed, then the changes are reflected in one table but
not elsewhere. This situation leads to data inconsistency.
By Jismy Joseph
Disadvantages of DBMS

• Size – Database management system


needs large amount of disk space,
internal memory.
• Expensive – Mainframe DBMS is very
expensive.
• Additional Hardware requirement –
Depending upon the complexity of the
DBMS, additional hardware may be
required
• Complexity By Jismy Joseph
File-Based Systems versus DBMS

File-Based Systems
• Collection of application programs
that perform services for the end
users (e.g. reports).
• Each program defines and
manages its own data.
By Jismy Joseph
File-Based Processing

By Jismy Joseph
Limitations of File-Based Approach
• Data Redundancy and inconsistency – the
same information may be duplicated in several
places.
• Difficulty in accessing Data.
• Integrity Problem – the data values stored in
the database must satisfy certain types of
consistency constraints. When new constraints
are added, it is difficult to change the program
to enforce them.

By Jismy Joseph
Limitations of File-Based Approach

• Separation and isolation of data


– Each program maintains its own set of data.
– Users of one program may be unaware of
potentially useful data held by other programs.

• Duplication of data
– Same data is held by different programs.
– Wasted space and potentially different values
and/or different formats for the same item.

By Jismy Joseph
Limitations of File-Based Approach

• Concurrent Access problem – current access


needs a supervision to maintain consistent
data. But supervision is difficult to provide in
file based approach because data may be
accessed by many different application
program that have not been coordinated
previously
• Security problem -

By Jismy Joseph
Limitations of File-Based Approach

• Data dependence
– File structure is defined in the program code.

• Incompatible file formats


– Programs are written in different languages, and so
cannot easily access each other’s files.

• Fixed Queries/Proliferation of application


programs
– Programs are written to satisfy particular functions.
– Any new requirement needs a new program.
By Jismy Joseph
DBMS vs. RDBMS

• Relationship among tables is maintained in a RDBMS


whereas this not the case DBMS as it is used to manage
the database.
• DBMS accepts the ‘flat file’ data that means there is no
relation among different data whereas RDBMS does not
accepts this type of design.
• DBMS is used for simpler business applications whereas
RDBMS is used for more complex applications.
• Although the foreign key concept is supported by both
DBMS and RDBMS but its only RDBMS that enforces the
rules.
• RDBMS solution is required by large sets of data whereas
small sets of data can be managed by DBMS.
By Jismy Joseph
Describing and storing data in
a DBMS
Data Models
• Underlying the structure of a
database is called Data Model.
• Integrated collection of concepts for
describing data, relationships
between data, and constraints on
the data in an organization.
By Jismy Joseph
Data Model

• Three data models that are used for


database management are:
1. The Relational Data Model
2. The Hierarchical Data Model
3. The Network Data Model

By Jismy Joseph
The Relational Data Model
• In this model,the data is organized into
tables (ie., rows and columns). These
tables are called relations.
•A row in a table represents a
relationship among a set of values.
Consider a sample database with three
tables (relations):Suppliers, Items,
Quantities:
Suppliers (sup-no#,sup-name,status,
city)
Items ( item-no#, item-name, price)
Quantities By(sup-no#,
Jismy Joseph item-no#, Qty)
Suppliers
Sup-no# Sup-Name Status City
S1 Britannia 10 Delhi
S2 New 30 Mumbai
S3 Cockg 10 Delhi

Items
Item-no# Item-name Price
I1 Milk 15.00
I2 Cake 5.00
I3 Bread 9.00
I4 Biscuit 14.00
I5 Ice cream 6.00
I6 Jam 10.00

Quantities
Sup-no# Item-no# Qty
S1 I2 10
S1 I3 20
S1 I6 20
S2 I4 20
S2 I5 10
S3 I1 10
By Jismy Joseph
•Rows of relations are generally referred to
as tuples or records and the columns are
usually referred to as attributes or
field.
•No two tuples are identical and their
ordering is not important.

•A relationship is represented by combining


the primary key of the relations.

•various operations can be performed on


relations such as insert new tuples, delete
tuples and modify tuples.

•There are several languages for expressing


these operations. One such language is
relational query language.
By Jismy Joseph
The Network Data Model
• In this model, data is represented by
collections of records and relationships
among data are represented by links. Ie.,
the collection of records which are
connected to one another by means of links.
• A record is a collection of fields
(attributes), each of which contains only
one data value.
• A link is an association between precisely
two records.
• The structure of the database is shown as
an arbitrary graph in which the records
form the nodes and links form the edges.
• There is no concept Byof a root node.
Jismy Joseph
Consider the structure of the above sample
database of suppliers, items and quantities.

S Britanni 1 Delhi S2 New 30 Mumbai S3 Cockg 10 Delhi


1 a 0

10 20 20 20 10 10

I1 milk 15 I2 cake 5 I3 brea 9 I4 biscui 14 I5 icecrea 6 I6 ja 10


d t m m
By Jismy Joseph
• The operations on a network database are
performed through a data manipulation
language for network model.

• The operations that can be performed on a


network database include find, insert,
delete, modify etc.

• The inserting or removing records include


connect, disconnect and reconnect
operations.

By Jismy Joseph
The Hierarchical Data Model
•Same as network model. The only difference is
that in the hierarchical model, records are
organized as trees rather than arbitrary
graphs.
•The record type at the top of the tree is
usually known as root.
•In general, the root may have any number of
dependents and each of these dependents may
have any number of low level dependents and
so on.
Consider the hierarchical view of the above
sample database of suppliers, items and
quantities. By Jismy Joseph
S1 Britannia 10 Delhi

I2 Cake 5
I3 Bread 9
10
I6 Jam 10
20
20

S2 New 30 Mumb
ai

I4 Biscuit 14
I5 Icecrea 6
m 20
10

S3 Cockg 10 Delhi

I1 Milk 15

10Joseph
By Jismy
In this tree structure supplier record type
is the root node.
•Here the relationship is expressed in the
form of a tree with all the edges pointing
to the leaf.
•The operations on a hierarchical database
are performed through a data manipulation
language for hierarchical data model.
•The various operations include retrieval,
insertions , deletions and modifications of
records.

By Jismy Joseph
DBMS ARCHITECTURE

• The logical DBMS architecture

• The physical DBMS architecture

By Jismy Joseph
DBMS ARCHITECTURE

• The logical DBMS architecture

The logical architecture deals with the way data is stored and
presented to users.

• The physical DBMS architecture

By Jismy Joseph
DBMS ARCHITECTURE

• The logical DBMS architecture

The physical architecture is concerned with the s/w


components that make up a DBMS.

• The physical DBMS architecture

By Jismy Joseph
Levels of abstraction in a DBMS

By Jismy Joseph
Three Level Architecture of DBMS / Levels
of Abstraction in a DBMS
A major purpose of a database system is to provide
users with an abstract view of the data. That is, the
system hides certain details of how the data is
stored and maintained.
• External or View Level
• Conceptual Level
• Internal or Physical Level

By Jismy Joseph
Three Level Architecture of DBMS
continue…
External
View 1 View 2 View 3
Level

Conceptual
Level

Physical
Level

By Jismy Joseph
Three Level Architecture of DBMS
continue…
Sales Officer Inventory Controller

View 1 View 2
External Item_Name Item_Name
Level Price Stock

Conceptual
Conceptual Item_Number Character (6)
Item_Name Character(30)
Level Price Numeric(5,2)
Stock Numeric(4)

Physical
Stored_Item Length=50
Physical Item # Type = Byte(6), offset = 0, Index = Ix
Name Type = Byte(30), offset = 6
Level Price Type = Byte(8), offset = 36
Stock Type = Byte(4), offset = 44

By Jismy Joseph
Physical Level
• Lowest level of abstraction
• Describes how the data are actually stored.
• Describes low level data structures in detail.
Logical Level
• Describes what data are stored in the database,
What relationship exist among them.
• Database Administrator use the logical level of
abstraction.
View Level
• The highest level of abstraction describes only the
part of the entire database
By Jismy Joseph
External or View Level

This level is closest to the users and is concerned with the


way in which the data is viewed by individual users.
Most of the users are not concerned with all the
information contained in the database. Instead they
need only a part of the database relevant to them. The
system provides many views for the same database.

By Jismy Joseph
External or View Level
continue…

• Highest level of abstraction of database.


• Allows to see only the data of interest to them.
• Users – Application programmers or end-users.
• Any no. of external views – external schema.

By Jismy Joseph
External or View Level
continue…

• It consists of the definition of logical records and


relationships in the external view.
• It also contains the methods for deriving the
objects such as entities, attributes and
relationships in the external view from the
Conceptual View.
By Jismy Joseph
Conceptual Level

This level of abstraction describes what data are actually


stored in the database. It also describes the
relationships existing among data. At this level, the
database is described logically in terms of simple data-
structures. The users of this level are not concerned
with how these logical data structures will be
implemented at the physical level, rather they just are
concerned about what information is to be kept in the

database. By Jismy Joseph


Conceptual Level
continue…

• The sum total of DBMS users view.


• Describes what data are actually stored in the
database (ie, all the records and relationships
included in the database).

By Jismy Joseph
Conceptual Level
continue…

• The conceptual view is a representation of the


entire information content of the database in a
form that is some what abstract in comparison
with the way in which the data is physically
stored.

By Jismy Joseph
Conceptual Level
continue…

• The conceptual view is defined by means of the


conceptual schema, which includes the definition
of each of the various types of conceptual
records and the mapping between the
conceptual schema and the internal schema.

By Jismy Joseph
Internal or Physical Level

• Lowest level of abstraction.


• Describes how the data are physically stored.
• Internal view – internal schema (not only defines the
various types of stored record but also specifies what
indexes exists, how files are represented, etc.)

By Jismy Joseph
Internal or Physical Level

The internal level is closest to physical storage.


This level is also termed as physical level. It
describes how the data are actually stored on
the storage medium. At this level, complex low-
level data structures are described in detail.

By Jismy Joseph
Data Independence
The ability to modify a schema definition in one
level without affecting a scheme definition in the
next higher level is called DATA INDEPENDENCE
• Physical Data Independence

• Logical Data Independence

By Jismy Joseph
Physical Data Independence

It refers to the ability to modify the scheme followed at the


physical level without affecting the scheme followed at the
conceptual level.
The application programs remain the same even though the
scheme at the physical level gets modified.
Modifications at the physical level are occasionally necessary in
order to improve performance of the system.

By Jismy Joseph
Logical Data Independence

It refers to the ability to modify the conceptual scheme without


causing any changes in the schemes followed at view levels.
The logical data independence ensures that the application
programs remain the same.
Modifications at the conceptual level are necessary whenever
logical structures of the database get altered because of some
unavoidable reasons.

By Jismy Joseph
Physical & Logical
Data Independence

It is more difficult to achieve logical data independence


than the physical data independence.
The reason being that the application programs are
heavily dependent on the logical structure of the
database.

By Jismy Joseph
Structure of a DBMS

By Jismy Joseph
DBMS Structure
parser & query optimizer
Responsible for receiving query language statements and changing to a
form the DBMS can understand.
Transaction manager
The transaction manager maintains tables of authorization concurrency.
Recovery Manager
Ensures that the database remains in a consistent state in the presence
of failures. Responsible for transaction commit and abort.
Buffer Manager
Responsible for the transfer of data between main memory and
secondary storage.
Disk Space Manager
The lowest layer of the DBMS software deals with management of space
on disk, where data is stored. Higher layers allocate, deallocate, read
and write pages through this layer, called disk space manager.
By Jismy Joseph
DBMS Structure

Lock Manager
Keep track of request for locks and grants locks
on database objects when they become
available.

By Jismy Joseph
Overview of
Database Design

By Jismy Joseph
Entities, Attributes and Entity Sets
Entity
An entity is an object in the real world that is
distinguishable from other objects. For example a person
or a book.
Entity Set
A collection of similar entities are called entity set. For eg.
all employees of a bank.
Attribute
- An entity is described using a set of attribute.
- All entities in a given entity set have the same attributes.
- For eg. The attributes of the Employees entity set are
name, social security number etc.
By Jismy Joseph
Domain
Set of allowable values for one or more attributes.
Degree of a relation
The number of attributes the relation has.
Cardinality
Total number of records/tuples are knowns as
cardinality

By Jismy Joseph
Key, Primary Key, Candidate Key

Key
A key is a minimal set of attributes
whose values uniquely identify an
entity in the set.

By Jismy Joseph
Candidate key
The candidate key is also used to identify a particular
record. We can use either one attribute as a candidate
key or the combination of one or more attributes as
the candidate key. The subset of candidate key is not
again a candidate key. For eg. We can set studentId
attribute as candidate key or the combination of
StudentName and HouseNo attributes as the
candidate key, but we can’t use the combination of
StudentId, StudentName, & HouseNo attribute as the
Candidate key because the subsets ((StudentName,
HouseNo) , (StudentId)) of the above combination
(StudentId, StudentName, & HouseNo) can be used as
a candidate key.
By Jismy Joseph
primary key
candidate key selected to identify
tuples uniquely within relation.
Alternate Key
The key which is not used as a
primary key.

By Jismy Joseph
Relationships and relationship sets
A relationship is an association among two or
more entities. For eg

A relationship set is a collection of similar


relationships. By Jismy Joseph
Relationships and Relationship sets

A relationship set can be thought of as a set of


n-tuples:

Each n-tuple denotes a relationship involving


n entities e1 through en, where entity ei is in
entity set Ei.

By Jismy Joseph
Relationships and Relationship sets
• A relationship can also have descriptive
attributes. Descriptive attributes are used to
record information about the relationship,
rather than about any one of the participating
entities. for example, we may wish to record
that Arun works in the pharmacy department as
of January 1991. This information is captured
in the following figure by adding an attribute,
since, to Works_In.
By Jismy Joseph
Relationships and Relationship sets

By Jismy Joseph
Relationships and Relationship sets
An instance of a relationship set is a set of
relationships. Intuitively, an instance can be
thought of as a 'snapshot' of the relationship
set at some instant in time.
An instance of the Works_ln relationship set is
shown in the following figure where Each
Employees entity is denoted by its ssn, and
each Departments entity is denoted by its did,
for simplicity. The since value is shown beside
each relationship.
By Jismy Joseph
Relationships and Relationship sets

51

56

60

By Jismy Joseph
Relationships and Relationship sets
suppose that each department has offices
in several locations and we want to record the
locations at which each employee works. This
relationship is ternary because we must record
an association between an employee, a
department, and a location. For Eg.

By Jismy Joseph
By Jismy Joseph
The entity sets that participate in a relationship set need not be
distinct; sometimes a relationship might involve two entities in
the same entity set.

By Jismy Joseph
Additional Features of the ER Model

Key Constraints
Key constraints are restrictions on the contents of
the database or on database operations.
For eg. each department has at most one manager. It
implies that each Departments entity appears in at
most one manager relationship in any allowable
instance of Manages. This restriction is indicated in
the ER diagram of the following Figure by using an
arrow from Departments to Manages. Intuitively, the
arrow states that given a Departments entity, we can
uniquely determine the Manages relationship in
which it appears. By Jismy Joseph
By Jismy Joseph
An instance of the Manages Relationship set is :

By Jismy Joseph
Key Constraints for Ternary Relationships

The following figure shows a ternary relationship


with key constraints.

By Jismy Joseph
Each employee works in at most one
department and at a single location. Note that
each department can be associated with
several employees and locations and each
location can be associated with several
departments and employees; however, each
employee is associated with a single
department and location.

By Jismy Joseph
Aggregation
Aggregation allows us to indicate that a relationship
set participates in another relationship set.

By Jismy Joseph
• The dashed box around Sponsors (and its
participating entity sets) used to denote
aggregation.
• There are really two distinct relationships,
Sponsors and Monitors, each possibly with
attributes of its own.
• the Monitors relationship has an attribute until
that records the date until when the employee is
appointed as the sponsorship monitor.
• The Sponsors relationship has an attribute since
that records the date when the sponsorship took
effect. By Jismy Joseph
Conceptual Design with the E-R Model
• Entity versus Attribute
• Entity versus Relationship
• Binary versus Ternary Relationships
• Aggregation versus Ternary Relationships

By Jismy Joseph
Entity versus Attribute

While identifying the attributes of an entity set,


it is sometimes not clear whether a property
should be modeled as an attribute or as an
entity set. For example, consider adding
address information to the Employees entity
set. One option is to use an attribute address.
This option is appropriate if we need to record
only one address per employee.
By Jismy Joseph
An alternative is to create an entity set called
Addresses and to record associations between
employees and addresses using a relationship
(say, Has_Address). This more complex
alternative is necessary in two situations:
• We have to record more than one address for
an employee.
• We want to capture the structure of an address
in our ER diagram. For example, we might
break down an address into city, state,
country, and Zip code
By Jismy Joseph
Entity Versus Relationship

By Jismy Joseph
Binary versus Ternary Relationships

The above ER diagram models a situation in which an employee can


own several policies, each policy can be owned by several
employees, and each dependent can be covered by several
By Jismy Joseph
policies .
Suppose that we have the following additional
requirements:
• A policy cannot be owned jointly by two or
more employees.
• Every policy must be owned by some
employee.
• Dependents is a weak entity set, and each
dependent entity is uniquely identified by
taking pname in conjunction with the policyid
of a policy entity (which, intuitively, covers the
given dependent).
By Jismy Joseph
By Jismy Joseph
Aggregation versus Ternary Relationships

By Jismy Joseph
• According to this diagram, a project can be
sponsored by any number of departments
• A department can sponsor one or more
projects.
• Each sponsorship is monitored by one or more
employees.
If we don't need to record the until attribute of
Monitors, then we might reasonably use a
ternary relationship, say, Sponsors2, as shown in
the following diagram

By Jismy Joseph
By Jismy Joseph
Overview of Unified
Modeling Languages(UML)
The Unified Modeling Language (UML) is a general-purpose
modeling language in the field of software engineering, which is
designed to provide a standard way to visualize the design of a system.
Business Modeling: In this phase, the goal is to describe the business
processes involved in the software application being developed.

By Jismy Joseph
• System Modeling: The understanding of business
processes is used to identify the requirements for the
software application. One part of the requirements is the
database requirements.
• Conceptual Database Modeling: This step corresponds to
the creation of the ER design for the database. For this
purpose, UML provides many constructs that parallel the
ER constructs.
• Physical Database Modeling: UML also provides pictorial
representations for physical database design choices,
such as the creation of table spaces and indexes.
• Hardware System Modeling: UML diagrams can be used
to describe the hardware configuration used for the
application.
By Jismy Joseph
There are many kinds of diagrams in UML.
Use case diagrams describe the actions performed by
the system in response to user requests, and the
people involved in these actions. These diagrams
specify the external functionality that the system is
expected to support.
Activity diagrams shows the flow of actions in a
business process.
Statechart diagrams describe dynamic interactions
between system objects.
Class diagrams are similar to ER diagrams, Both entity
sets and relationship sets can be represented as
classes in UML. By Jismy Joseph

You might also like