0% found this document useful (0 votes)
82 views134 pages

Database Systems: Ch. Venkata Rami Reddy Cs-222 Ii-Ii Sem

The document discusses the key topics in Unit 1 of a database systems course, including database concepts and architecture, data modeling using ER and EER diagrams, and specialization and generalization. The unit covers database design, DBMS components and applications, and data modeling using entities, attributes, and relationships. Students will learn database design and modeling techniques to apply to real-world applications.

Uploaded by

Yashwant Yarra
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)
82 views134 pages

Database Systems: Ch. Venkata Rami Reddy Cs-222 Ii-Ii Sem

The document discusses the key topics in Unit 1 of a database systems course, including database concepts and architecture, data modeling using ER and EER diagrams, and specialization and generalization. The unit covers database design, DBMS components and applications, and data modeling using entities, attributes, and relationships. Students will learn database design and modeling techniques to apply to real-world applications.

Uploaded by

Yashwant Yarra
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

 

Database Systems 
Ch. Venkata Rami Reddy
CS-222 II-II SEM
UNIT – I

• Database System- concepts and architecture,


Data modelling using the Entity Relationship
(ER) modelling and Enhanced Entity
Relationship (EER) modelling, Specialization
and Generalization.

[Link]
Venkata Rami Reddy Ch Dept of CSE
UNIT-1

• Understanding the DBMS basic concepts


• Know the Applications of DBMS.
• To know the Database Designing for the real time
applications by using ER and EER models.
Objectives: • To understanding the Specialization and
Generalization

[Link]
Venkata Rami Reddy Ch Dept of CSE
UNIT-1

• Students will able to know the DBMS


concepts and their importance.
• Students will able to design the databases for
any real time applications.
Outcomes::
• Students will the constraints to be considered
while designing the databases

[Link]
Venkata Rami Reddy Ch Dept of CSE
UNIT-1

1. Introduction to Database Systems


2. File System
3. Advantages of DBMS
4. DBA, Designers and End users
Topics::
5. Data Models
• Relational Model
• Entity-Relationship Model
• Hierarchical Model
• Network Model
• Object-Oriented Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Contents

6. Levels of Abstraction or Three-Schema


architecture
7. DBMS architecture
8. CLASSIFICATION OF DATABASE
Topics: MANAGEMENT SYSTEMS
9. Phases of Database Design

[Link]
Venkata Rami Reddy Ch Dept of CSE
Contents

10. Entity-Relationship model


• Types of Attributes
• Entity Types and Entity Sets:
Topics: • Notations of ER Diagrams
• Example Database Application
• Relationship:
• Degree of a Relationship Type
• Constraints on Relationships

[Link]
Venkata Rami Reddy Ch Dept of CSE
Contents

11. EER (Enhanced Entity Relationship) Model


• SUBCLASSES, SUPERCLASSES AND
INHERITANCE

Topics: • Specialization
• Generalization

[Link]
Venkata Rami Reddy Ch Dept of CSE
data
• A data mean known facts or raw facts that can be
recorded and that have implicit meaning.
Topic 1 • For example, consider the names, telephone,
numbers, and addresses of the people you know.
Introduction to You may have recorded this data in an indexed
Database
address book, you may have stored it on a hard
Systems
drive, using a personal computer and software
Introduction to Dbms such as Microsoft Access, or Excel.
• Information: Processed data.

in

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database
• Database is a large collection of related data that
can be stored generally describes activities of an
Topic 1 organization.
Characteristics of data in a database:
Introduction to
Database Systems
Shared: Data in a database are shared among
different users and different applications.
Persistence : Data in database exist permanently.
Correctness: Data should be correct
Security: Data should be protected from un
authorized access
Non-redundancy: No two data items in a database
should represent the same entity.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Properties


It is used to store data of an organization.

Topic 1
•A database is designed and developed for a
specific purpose.
Introduction to
• It has some source from which data is derived and
Database Systems
it is populated with that data.
• It can be of any size
• It allows multiple users to share and access
database at the same time.
Eg: - University database which includes students,
faculty, courses & class rooms information along
with activities such as enrolment and teaching
courses.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Management System

• A database management system (DBMS) is


Topic 1 a collection of programs (software) for
defining, creating, manipulating and
Introduction to maintaining a database.
Database Systems

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Management System

• The DBMS is a general-purpose software


Topic 1 package that facilitates the processes of
defining, constructing, manipulating, and
Introduction to sharing databases among various users
Database Systems and applications.
.
Purpose of DBMS

[Link]
Venkata Rami Reddy Ch Dept of CSE
Actions of DBMS
• Defining a database involves specifying the data
types, structures, and constraints for the data to
Topic 1 be stored in the database
• Manipulating a database includes functions
Introduction to such as querying the database to retrieve
Database Systems specific data, updating the database to reflect
changes, and generating reports from the
data
• Constructing the database is the process of
storing the data itself on some storage medium
that is controlled by the DBMS.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Actions of DBMS
• Sharing a database allows multiple users and
programs to access the database
Topic 1 concurrently

Introduction to
Database Systems

[Link]
Venkata Rami Reddy Ch Dept of CSE
Simplified database system
environment

Topic 1

Introduction to
Database Systems

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Applications
• Banking – For customer information, accounts,
and loans, and banking transactions.
Topic 1
• Airlines – For reservation and schedule
information, flight details etc.
Introduction to
Database Systems • Universities – For student and faculty information,
course registrations, and grades. [registration,
grades]

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Applications:
• Credit Card Transactions – For purchases on
credit card and generation of monthly
Topic 1 statements.
Introduction to
• Telecommunication – For keeping records of
Database Systems calls made, generating monthly bills,
maintaining balances on prepaid calling cards,
and storing information about communication
networks.
• Finance – For storing information about
holdings, sales, and purchases of financial
instruments such as stocks and bonds.
• Sales – For customer, product, and purchase
information. [customers, products, purchases]
[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Applications:
• Manufacturing – For management of
supply chain and for tracking production of
Topic 1 items in factories, inventories of items in
warehouses/stores, and orders for items.
Introduction to
[production, inventory, orders, supply chain]
Database Systems

• Human Resources – For information about


employees, salaries, payroll taxes and
benefits, and generation of paychecks.
[employee records, salaries, tax deductions]

[Link]
Venkata Rami Reddy Ch Dept of CSE
File System

• Before the evolution of DBMS, File Systems


are used to store and manage the data.
Topic 2
• In File System data will be stored in
individual files.
 File System
• A File is a collection of data.
• Files are typically designed to meet needs of
a particular department or user group.
• Files are also typically designed to be part of
a particular computer application

[Link]
Venkata Rami Reddy Ch Dept of CSE
File processing processing system

• In the file processing approach, each


department would "own" a collection of
Topic 2 relevant data and software applications to
manipulate that data.
 File System

[Link]
Venkata Rami Reddy Ch Dept of CSE
Drawbacks of File System

1. Data Redundancy and Inconsistency


Topic 2 2. Difficulty in accessing data
3. Data isolation
File System 4. Enforcing Integrity constraints
5. Atomicity problems
Dis advantages of Fi 6. Difficulty in concurrency control
lesystem
7. Security Problems

[Link]
Venkata Rami Reddy Ch Dept of CSE
Cont ...
Data Redundancy and Inconsistency:
• Data redundancy means appearing same data in
different places.
Topic 2
• In file system same information is stored at
File System different places it causes data-inconsistency
problems during updates.
Difficulty in accessing data:
• In file system application programs are used to
retrieve the data from the file.
• In order to retrieve data from files we need to
write special application program every time.
• This is not a convenient way because every time
the requirements may change need to write a
new program to carry out each new task
[Link]
Venkata Rami Reddy Ch Dept of CSE
Cont ...
Data isolation
• The data is scattered in different files and with
different formats in different locations.
• To retrieve the data from the files separate
Topic 2 programs are required for each and every format
and location.
File System
• So it is difficult to write application programs to
retrieve the data.
Enforcing Integrity constraints
• Data integrity means, all the data has to obey some
condition.
• Ex: Maximum marks of subject, Minimum balance
of account.
• In file system it is difficulty to set such type of
constraints.
• In File System integrity constraints are set at
[Link]
program level.
Venkata Rami Reddy Ch Dept of CSE
Cont ...
Atomicity problems:
• Atomicity is a property of a transaction it states
Topic 2 that either all actions to be performed or none.
• In file processing system incomplete
transactions cannot be roll back.
File System • Due to this data will be inconsistent.
Difficulty in concurrency control:
• concurrency means same file is accessed
/updated by different application programs at
the same time.
• In File Processing System it is not possible to
control concurrency.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Cont ...
Security Problems
• Since the information is scattered in different
Topic 2 files and does not have centralized access
path, so it is not possible to provide security
to the data so that everyone can access the
File System data.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Advantages of DBMS
1. Controlling Redundancy
2. Data Consistency
Topic 3 3. Data Security
4. Providing Storage Structures for Efficient Query
Processing
Advantages of 5. Providing Backup and Recovery
DBMS
6. Providing concurrency control
DBMS Advantages 7. Enforcing Integrity constraints
8. Report Writers

[Link]
Venkata Rami Reddy Ch Dept of CSE
Controlling Redundancy
• In non-database systems (File system) same data
is stored in many places.
• Redundancy leads to several problems
Topic 3 [Link] effort: same data can be entered
multiple times 2. Storage space is wasted. 3. Data
inconsistency.
Advantages of • In DBMS, all the data is stored in one place.
DBMS • In DBMS, all the data of an organization is
integrated into a single database.
• By controlling the data redundancy, you can save
storage space

[Link]
Venkata Rami Reddy Ch Dept of CSE
Data Consistency
• By controlling the data redundancy, the data
consistency is obtained.
Topic 3 • If a data item appears only once, any update
to its value has to be performed only once
and the updated value (new value of item) is
Advantages of immediately available to all users.
DBMS • If the DBMS has reduced redundancy to a
minimum level, the database system enforces
consistency.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Data Security
• It is the protection of the database from unauthorized
users.
Topic 3 • Only the authorized persons are allowed to access
the database.
• Some of the users may be allowed to access only a
Advantages of part of database i.e., the data that is related to them
DBMS or related to their department.
• Mostly, the DBA can access all the data in the
database.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Data Security

• Some users may be permitted only to retrieve


data, whereas others are allowed to retrieve
Topic 3 as well as to update data.
• The database access is controlled by the
DBA.
Advantages of
DBMS
• DBA creates the accounts of users and gives
rights to access the database.
• Typically, users or group of users are given
usernames protected by passwords.
• Most of the DBMSs provide the security sub-
system, which the DBA uses to create
accounts of users and to specify account
restrictions.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Providing Storage Structures for Efficient Query
Processing
• Database systems must provide capabilities to
execute queries efficiently.
• Because the database is typically stored on disk,
Topic 3 the DBMS must provide specialized data
structures to speed up disk search for the desired
records.
Advantages of • Auxiliary files called indexes are used for this
DBMS purpose.
• Indexes are typically based on tree data structures
or hash data structures.
• DBMS supports file manager to manage the
allocation of disk space for the DBMS files.
• Also it supports Buffer Manager to manage the
memory buffers used for processing the database
information.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Providing Backup and Recovery

• Most of the DBMSs have the 'backup and recovery'


sub-systems that automatically create the backup of
Topic 3 data and restore data if required.
• For example, if the computer system fails in the
middle of an update operation of the program, the
Advantages of recovery sub-system is responsible for making sure
DBMS that the database is restored to the state it was in
before the program started executing.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Providing concurrency control

• DBMS will support concurrency control tools for


permitting multiple users or application
Topic 3 programs to access the database concurrently,
while preserving the consistency of database.

Advantages of
DBMS

[Link]
Venkata Rami Reddy Ch Dept of CSE
Enforcing Integrity constraints

• Integrity constraints can be applied to database


so that correct data can be entered in to
Topic 3 database.
Ex: 1. minimum balance of a account is 1000
2. Max marks of a subject is 100
Advantages of
DBMS • Most database applications have certain
integrity constraints that must hold for the data.
• A DBMS should provide capabilities for defining
and enforcing these constraints.
• The simplest type of integrity constraint
involves specifying a data type for each data
item.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Report Writers

• Most of the DBMSs provide the report writer tools


used to create reports.
Topic 3 • The users can create reports very easily and
quickly.
• Once a report is created, it can be used many times
Advantages of and it can be modified very easily.
DBMS

[Link]
Venkata Rami Reddy Ch Dept of CSE
Actors of DBMS

Topic 4
DBA, Designers
and End users

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Administrator(DBA)

• The database administrator is a person


having central control over data and
Topic 4 programs accessing the data.
Database • DBA coordinates all the activities of the
Administrator database system
• They are the users who are most familiar
with the database and are responsible for
creating, modifying, and maintaining the
database.
• DBA is responsible for granting permission to
the users of the database and stores the
profile of each user in the database
[Link]
Venkata Rami Reddy Ch Dept of CSE
Responsibilities of
1. Installing and upgrading the database server
and application tools
Topic 4 2. Allocating system storage and planning future
storage requirements for the database
system
DBA 3. Modifying the database structure, as
necessary, from information given by
application developers
4. Enrolling users and maintaining system
security
5. Controlling and monitoring user access to the
database

[Link]
Venkata Rami Reddy Ch Dept of CSE
Responsibilities of DBA

7. Monitoring and optimizing the performance


of the database
Topic 4 8. Planning for backup and recovery of
database information and restoring
databases
Responsibilities
of DBA 9. Maintaining archived data
10. Contacting database vendor for
technical support
11. Generating various reports by querying
from database as per need

[Link]
Venkata Rami Reddy Ch Dept of CSE
Database Designers
• Database designers are responsible for
identifying the data to be stored in the
Topic 4 database and for choosing appropriate
structures to represent and store this data.
• It is the responsibility of database
Database Designers designers to communicate with all
prospective database users in order to
understand their requirements, and to
come up with a design that meets these
requirements.

[Link]
Venkata Rami Reddy Ch Dept of CSE
End Users

• End users are the people whose jobs


require access to the database for
Topic 4 querying, updating, and generating
reports.
• There are several categories of end
End Users users:
• Casual end users
• Naive or parametric end users
• Sophisticated end users
• Stand-alone users

[Link]
Venkata Rami Reddy Ch Dept of CSE
Casual end users

• Casual end users occasionally access the


Topic 4 database, but they may need different
information each time.
• Casual users uses query language to
End Users interact with the database.
• These are typically middle- or high-level
managers.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Naive or parametric end users

• These are also called unsophisticated users.


Topic 4 • Naive users make up a sizable portion of
database end users.
• These users uses Application programs to
End Users interact with the database.
• Bank tellers check account balances and post
withdrawals and deposits.
• Reservation clerks fur airlines, hotels, and car
rental companies check availability for a given
request and make reservations

[Link]
Venkata Rami Reddy Ch Dept of CSE
Sophisticated end users
• Sophisticated end users include engineers,
scientists, business analysts, and others
Topic 4 who thoroughly familiarize themselves with
the facilities of the DBMS so as to
implement their applications to meet their
End Users complex requirements.

Stand-alone users
• Stand-alone users maintain personal
databases by using ready-made program
packages that provide easy-to-use menu-
based or graphics-based interfaces.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Data Models
• Data model specifies how data is organized in
database.
Topic 5 • A data model is a collection of concepts that
can be used to describe the structure of a
Data Models database.
• Structure of a database mean the data types,
Database Models
relationships, and constraints .
Types of Data Models
• Relational Model
• Entity-Relationship Model
• Hierarchical Model
• Network Model
• Object-Oriented Model
[Link]
Venkata Rami Reddy Ch Dept of CSE
Relational Model

• Most commonly used model is the relational


model.
Topic 5 • In this model data is organized as two-
dimensional tables.
Types of Data
Models
• The relational model uses a collection of
tables to represent both data and the
relationships among those data.
• Each table has multiple columns, and each
column has a unique name.
• Each table is called relation.
• Each row is called tuple.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Relational Model

Topic 5

Types of Data
Models

[Link]
Venkata Rami Reddy Ch Dept of CSE
Entity-Relationship Model

• It is used to design database.


• Entity-Relationship model is based on the
Topic 5 notion of real world entities and relationship
among them. 
Types of Data
Models
• It is a diagrammatic representation of
database.
• ER Model is based on:
• Entities and their attributes
• Relationships among entities

[Link]
Venkata Rami Reddy Ch Dept of CSE
Entity-Relationship Model
Entity
• An entity in ER Model is real world entity, which has
Topic 5 some properties called attributes
• It is a real world thing about which we want to maintain
Types of Data a data.
Models • For example, in a school database, a student is
considered as an entity. Student has various attributes
like name, age and class etc.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Hierarchical Model
• A hierarchical data model is a data model in
which the data is organized into a tree like
Topic 5 structure.
• First commercial DBMS is based on this model.
Types of Data • In Hierarchical model data is represented as
Models records and the records organized as collection
of trees.
• The relationships among the data are
represented by links, which can be viewed as
pointers.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Network Model
Network Model
• In Network model data is represented as records
Topic 5 and the records organized as collection of
arbitrary graphs.
Types of Data • The relationships among the data are represented
Models by links, which can be viewed as pointers.
• In network model a record can have any number
of parent records.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Object-oriented Model
An object database (also object-oriented database
management system, OODBMS) is a 
database management system in which information is
Topic 5
represented in the form of objects as used in 
object-oriented programming.
Types of Data Object databases are different from relational databases
Models  which are table-oriented. 
Object-relational databases are a hybrid of both
approaches.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Network Model

Topic 5

Types of Data
Models

[Link]
Venkata Rami Reddy Ch Dept of CSE
Schemas, Instances, and Database
State
• Database Schema refers to the overall structure of a
database.
• The description of a database is called the database
Sub topic 5 schema, which is specified during database design and is
not expected to change frequently
Schema Diagram:
Schema
Student

Course

Teacher

[Link]
Venkata Rami Reddy Ch Dept of CSE
Instance:

• The data in the database at a particular moment in


time is called instance or database state.
subTopic 5 • The distinction between database schema and
database state is very important.
Database state:
instance • At any point in time, the database has a current state.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Levels of Abstraction or Three-Schema
architecture:

Topic 6

Three-Schema
architecture

3-Schema Architec
ture

[Link]
Venkata Rami Reddy Ch Dept of CSE
Internal level or internal schema:
• The internal schema uses a physical data
model that describes the complete details of
Topic 6 physical data storage and access strategies.

Three-Schema
• It tells us what data is stored in the database
architecture
and how.
• Physical Storage structures includes B-trees,
B+ tree and hash tables etc.
• Some of the access strategies are primary
index, single-level index and multilevel index

[Link]
Venkata Rami Reddy Ch Dept of CSE
Conceptual level or conceptual schema

• The conceptual level has a conceptual


schema, which describes the structure of the
Topic 6 whole database .

Three-Schema
• The conceptual schema hides the details of
architecture
physical storage structures and concentrates
on describing entities, data types,
relationships, user operations, and
constraints.
• Usually, a representational data model is
used to describe the conceptual schema
when a database system is implemented.

[Link]
Venkata Rami Reddy Ch Dept of CSE
External level or External View:

External level or External View:

Topic 6
• The external or view level includes a number
user views.
Three-Schema • The external level is the view that the
architecture individual user of the database has.
• Each external schema describes the part of
the database that a particular user group is
interested in and hides the rest of the
database from that user group.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Data Independence

• Data independence can be defined as the


capacity to change the schema at one level of
Topic 6 a database system without having to change
the schema at the next higher level.
Three-Schema
architecture • We can define two types of data
independence:
1 Physical data independence
2. Logical data independence

[Link]
Venkata Rami Reddy Ch Dept of CSE
Physical data independence:

• Physical data independence is the capacity


Topic 6 to change the internal schema without
having to change the conceptual schema.
Three-Schema • Hence, the external schemas need not be
architecture changed as well.
• Changes to the internal schema may be
needed because some physical files had to
be reorganized-for example, by creating
additional access structures-to improve the
performance of retrieval or update.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Logical data independence:

• Logical data independence is the capacity


to change the conceptual schema without
Topic 6
having to change external schema or
Three-Schema
application programs.
architecture • We may change the conceptual schema to
expand the database (by adding a record
type or data item), to change constraints, or
to reduce the database (by removing a
record type or data item).
 

[Link]
Venkata Rami Reddy Ch Dept of CSE
DBMS architecture

The Functional components of a database


system can be divided in to
Topic 7
• Query Processor Components
• Storage Manager Components
DBMS architecture

[Link]
Venkata Rami Reddy Ch Dept of CSE
Architecture Diagram

Topic 7

DBMS
architecture

Dbms Architecture

[Link]
Venkata Rami Reddy Ch Dept of CSE
Query Processor Components

The Query Processor Components include:


DDL interpreter:
Topic 7 • It interprets DDL statements and converts them in
to a set tables which are saved in the data
DBMS architecture dictionary
DML compiler:
• It translates DML statements into low-level
instructions that are understood by the Query
Evaluation Engine.
• It also optimizes the DML Queries for efficient
execution by the Query Evaluation Engine.
Query evaluation engine:
• It executes low-level instructions generated by the
DML compiler and produces results.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Storage Manager Components


The storage manager components include:
File manager:
Topic 7 • It manages the allocation of disk-space for
the storage of DBMS files.
DBMS architecture Buffer manager:
• It is responsible for fetching data from disk
storage into main memory buffers for
processing, and then writing the updated
data back onto the disk.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Storage Manager Components

Authorization and integrity manager:


• It tests for the satisfaction of integrity
Topic 7 constraints and checks the authority of
users to access data.
DBMS architecture Transaction manager:
• This component ensures that concurrent
transactions proceed without conflict and
the database remains in a consistent
(correct) state despite system failures.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Data Components

Data files:
• Which stores the database itself.
Topic 7 Data dictionary:
• It is a metadata file, which stores the database
DBMS architecture schema. It stores metadata about the structure
of the database.
Indices:
• It can provide fast access to data items. Like
the index in this textbook, a database index
provides pointers to those data items that hold
a particular value.
Statistical data:
• It stores the statistical information about
processing of previous queries.
[Link]
Venkata Rami Reddy Ch Dept of CSE
CLASSIFICATION OF DATABASE
MANAGEMENT SYSTEMS
Several criteria are normally used to classify
DBMSs are
Topic 8 1. Based on data model
2. No of users supported by the System
CLASSIFICATION
OF DATABASE
3. Number of sites over which the database is
MANAGEMENT distributed
SYSTEMS 4. Cost
5. Based on purpose

[Link]
Venkata Rami Reddy Ch Dept of CSE
[Link] on Data Model:

• The main data model used in many current


commercial DBMSs is the relational data
Topic 8 model.
CLASSIFICATION
• The object data model was implemented in
OF DATABASE some commercial systems but has not had
MANAGEMENT widespread use.
SYSTEMS • Many legacy (older) applications still run on
database systems based on the hierarchical
and network data models.
• We can hence categorize DBMSs based on
the data model: relational, object, relational,
hierarchical, network, and other.

[Link]
Venkata Rami Reddy Ch Dept of CSE
[Link] of users supported by the System::

Multi-user vs. single-user


• Single-user systems support only one user at a
Topic 8 time and are mostly used with Personal
computers.
CLASSIFICATION • Multiuser systems, support multiple users
OF DATABASE concurrently.
MANAGEMENT
SYSTEMS

[Link]
Venkata Rami Reddy Ch Dept of CSE
3. Number of sites over which the database is
distributed

Centralized vs. distributed


•A DBMS is centralized if the data is stored at a
single computer site. A centralized DBMS can
Topic 8 support multiple users, but the DBMS and the
database themselves reside totally at a single
CLASSIFICATION computer site.
OF DATABASE
MANAGEMENT •A distributed DBMS (DDBMS) can have the actual
SYSTEMS database and DBMS software distributed over many
sites, connected by a computer network.

[Link]
Venkata Rami Reddy Ch Dept of CSE
4. Cost

•The majority of DBMS packages cost between


$10,000 and $100,000.
Topic 8 •Single-user low-end systems that work with
micro computers cost between $100 and $3000.
CLASSIFICATION
OF DATABASE At the other end of the scale, a few elaborate
MANAGEMENT packages cost more than $100,000.
SYSTEMS

[Link]
Venkata Rami Reddy Ch Dept of CSE
5. General-purpose vs. special-purpose

• A DBMS can be general purpose or special


purpose. When performance is a primary
Topic 8 • Consideration, a special-purpose DBMS can
be designed and built for a specific
CLASSIFICATION OF
DATABASE application such a system cannot be used
MANAGEMENT for other applications without major changes.
SYSTEMS
• Many airline reservations and telephone
directory systems developed in the past are
special purpose DBMSs.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Phases of Database Design

Phases of Database Design

Topic 9   Requirements collection


and analysis

Phases of
Database Design Conceptual Design

Logical Design
Data Model Mapping

Physical Design

[Link]
Venkata Rami Reddy Ch Dept of CSE
Requirements collection and analysis

•In this step, the database designers interview


prospective database users to understand and
Topic 9 document their data requirements.
• These requirements should be specified in as
Phases of detailed and complete a form as possible
Database Design

[Link]
Venkata Rami Reddy Ch Dept of CSE
Conceptual Design

•Once all the requirements have been collected and


analyzed, the next step is to create a conceptual
Topic 9 schema for the database; using a high-level
conceptual data model this step is called conceptual
Phases of design.
Database Design •The conceptual schema is a concise description of
the data requirements of the users and includes
detailed descriptions of the entity types,
relationships, and constraints; these are expressed
by using the ER Model
•This approach enables the database designers to
concentrate on specifying the properties of the data,
without being concerned with storage details.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Logical Design
• The next step in database design is the actual
implementation of the database, using a commercial
DBMS.
Topic 9
• Most current commercial DBMSs use an
implementation data model such as the relational or
Phases of
the object-relational database model.
Database Design
• In this phase the conceptual schema is transformed
from the high-level data model into the implementation
data model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Characteristics

Physical Design
•The last step is the physical design phase, during which
Topic 9 the internal storage structures, indexes, access paths,
and file organizations for the database files are specified.
Phases of
Database Design

[Link]
Venkata Rami Reddy Ch Dept of CSE
Entity-Relationship model
• Entity-Relationship model is a popular high,
level conceptual data model.
Topic 10
• ER Model is best used for the conceptual design
of database.
ER Model • The ER model describes data as entities,
relationships, and attributes.
ER-Model • ER Model is based on: Entities and
their attributes, Relationships among entities

[Link]
Venkata Rami Reddy Ch Dept of CSE
Entity:

• An entity, which is a "thing" in the real world


with an independent existence.
Topic 10 • An entity may be an object with a physical
existence
ER Model
• for example, a particular person, car, house,
or employee
ER-Model
• It may be an object with a conceptual
existence
• for example, a job, or a university course
• In the University database context, an
individual student, faculty member, a class
room, a course are entities

[Link]
Venkata Rami Reddy Ch Dept of CSE
Attributes


Attribute describes property or characteristics
of an entity
Topic 10
• These are the properties of the entity.
ER Model
• For example, an employee entity may be
described by the employee's name, age,
address, salary, and job. A particular entity
will have a value for each of its attribute
Entity_20Relation Types of Attributes
ship_20Model_mo
dule4_-1_PIP.mp4 1. simple versus composite
2. single-valued versus multivalued
3. stored versus derived.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Composite versus Simple (Atomic) Attributes

• Composite attributes can be divided into


smaller subparts
Topic 10 • For example, the Address attribute of the
employee entity can be subdivided into
ER Model StreetAddress, City, State, and Zip,3 with the
values "2311 Kirby," "Houston," "Texas," and
"77001."
• Attributes that are not divisible are called simple
or atomic attributes.
• Ex: Zipcode

[Link]
Venkata Rami Reddy Ch Dept of CSE
Single-Valued versus Multivalued Attributes

• Single-valued attribute is the attribute which


is having only single value.
Topic 10 • Most attributes have a single value for a
particular entity; such attributes are called
ER Model
single-valued.
• For example, Age, is a single-valued attribute
of a person.
• Multi-valued attribute is the attribute which
is having more than one value.
• an attribute can have a set of values for the
same entity-for example, a Colors attribute
for a car, or a phno attribute for a person.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Stored versus Derived Attributes

•Derived attribute is one whose value can be


calculated/derived from the values of other
Topic 10 attributes. The Age and BirthDate attributes of a
person.
ER Model
• For a particular person entity, the value of Age
can be determined from the current (today's)
date and the value of that person's BirthDate.
•The Age attribute is hence called a derived
attribute and is said to be derivable from the
BirthDate attribute, which is called a stored
attribute.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Entity Types and Entity Sets

•An entity type defines a collection (or set) of


entities that have the same attributes.
Topic 10 •Each entity type in the database is described
by its name and attributes.
ER Model •A database usually contains groups of entities
that are similar.
•For example, a company employing hundreds
of employees may want to store similar
information concerning each of the employees.
•These employee entities share the same
attributes, but each entity has its own value(s)
for each attribute.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Entity Types and Entity Sets

•The collection of all entities of a particular


entity type in the database at any point in time
Topic 10 is called an entity set.
•The entity set is usually referred to using the
ER Model same name as the entity type.
•An entity type is represented in ER diagrams
as a rectangular box enclosing the entity type
name.
•An entity type describes the schema or
intension for a set of entities that share the
same structure

[Link]
Venkata Rami Reddy Ch Dept of CSE
Key Attributes of an Entity Type
• An important constraint on the entities of an
entity type is the key or uniqueness
constraint on attributes.
Topic 10
• An entity type usually has an attribute
ER Model whose values are distinct for each
individual entity in the entity set. Such an
attribute is called a key attribute, and its
values can be used to identify each entity
Mod_207.1.mp4 uniquely.
• For the Employee entity type typical key
attribute is Empid.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Notations of ER Diagrams

Notations of ER Diagrams

Topic 10

ER Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Example Database Application: COMPANY

Example Database Application: COMPANY


• Initial Conceptual Design of COMPANY
Topic 10 database
• The company is organized as a collection of
ER Model departments.
• Each department
• has a unique name
• has a unique number
• is associated with a set of locations
• has a particular employee who acts as its
manager (and who assumed that position
on some date)
• controls a set of projects
[Link]
Venkata Rami Reddy Ch Dept of CSE
Cont ...
Each project
• has a unique name
Topic 10 • has a unique number
• has a single location
ER Model • has a set of employees who work on it
• is controlled by a single department
Each dependent
• has first name
• has a sex
• has a birthdate
• is related to a particular employee in a
particular way (e.g., child, spouse, pet)
• is uniquely identified by the combination of
her/his first name and the employee of which
[Link]
(s)he is a dependent
Venkata Rami Reddy Ch Dept of CSE
Cont ...

Each employee
• has a name
Topic 10 • has a SSN that uniquely identifies her/him
• has an address
ER Model • has a salary
• has a sex
• has a birthdate
• has a direct supervisor
• has a set of dependents
• is assigned to one department
• works some number of hours per week on
each of a set of projects (which need not
all be controlled by the same department)
[Link]
Venkata Rami Reddy Ch Dept of CSE
Cont...

Topic 10

ER Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Relationship:

•It is Association among two or more entities.


•When two or more entities are associated
Topic 10 with each other, we have an instance of a
Relationship.
ER Model •A relationship relates two or more distinct
entities with a specific meaning.
•It is represented by a diamond.
•Relationships can have their own attributes
•Whenever an attribute of one entity type
Relationships.mp4 refers to an entity (of the same or different
entity type), we say that a relationship exists
between the two entity types

[Link]
Venkata Rami Reddy Ch Dept of CSE
Relationship diagram:

Topic 10

ER Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Relationship Type:

• Relationships of the same type are grouped


or typed into a relationship type.
Topic 10

ER Model
• For example, the WORKS_ON relationship
type in which EMPLOYEEs and PROJECTs
participate, or the MANAGES relationship
type in which EMPLOYEEs and
DEPARTMENTs participate.
.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Relationship set

Topic 10

ER Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Degree of a Relationship Type

•The degree of a relationship is the number of


participating entities.
Topic 10 •It refers to number of entity sets that participate
in a relationship set.
ER Model •The degree of WORKS-FOR relationship is two.
•A Relationship type of degree two is called
binary, and a Relationship type of degree three is
called ternary.
•In ER diagrams, relationship types are displayed
as diamond-shaped boxes, which are connected
by straight lines to the rectangular boxes
representing the participating entity types.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Relationship Attributes

• A relationship type can have attributes describing


properties of a relationship.
Topic 10 • FOR EXAMPLE Ramireddy works for CSE
Department since 2011
ER Model • WORKS-FOR relationship type have attributes like
empid, deptid and since.
 

[Link]
Venkata Rami Reddy Ch Dept of CSE
Constraints on Relationships

• Relationship types usually have certain


constraints that limit the possible
Topic 10 combinations of entities that may participate
in the corresponding relationship set.
ER Model
• For example if the company has a rule that
each employee must work for exactly one
department, then we would like to describe
this constraint in the schema.
• Two main types of relationship constraints
1. Cardinality ratio
2. Participation.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Cardinality Ratios for Binary Relationships

• The cardinality ratio for a binary relationship


specifies the maximum number of
Topic 10
relationship instances that an entity can
participate in.
ER Model
• For example, in the WORKS_FOR binary
relationship type, DEPARTMENT:
EMPLOYEE is of cardinality ratio l: N,
meaning that each department can be related
to (that is, employs) any number of
employees but an employee can be related
to (work for) only one department.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Cardinality Ratios for Binary Relationships

For a binary relationship set the mapping


cardinality must be one of the following types:
Topic 10 • One to One(1:1)
ER Model
• One to many(l:N)
• Many to one(N:l)
• Many to many (M:N)
• Consider binary relationship set R between
entity sets A and B

[Link]
Venkata Rami Reddy Ch Dept of CSE
One to One (1:1)
•An entity in A is associated with at most one entity
in B, and an entity in B is associated with at most
Topic 10 one entity in A.
•An example of a 1:1 binary relationship is
ER Model MANAGES which relates a department entity to the
employee who manages that department. This
represents the mini-world constraints that at any
point in time-an employee can manage only one
department and a department has only one
manager.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Cardinality Ratios
• One to Many: An entity in A is associated with many
entities in B and an entity in B is associated with at
most one entity in A.
Topic 10
• Many to One: An entity in A is associated with at
most one entity in B, an entity in B is associated with
ER Model many entities in A.
• Ex: an employee works in a single department but a
department consists of many employees.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Cardinality Ratios

• Many to Many: An entity in A is associated with many


entities in B, and an entity in B is associated with many
Topic 10 entities in A.
• Ex: The relationship type WORKS_ON is of cardinality
ER Model ratio M:N, because the mini-world rule is that an
employee can work on several projects and a project
can have several employees.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Participation Constraints

• This constraint specifies the minimum number


of relationship instances that each entity can
Topic 10
participate in, and is sometimes called the
minimum cardinality constraint.
ER Model
• There are two types of participation constraints
1 total participation
2. Partial participation

[Link]
Venkata Rami Reddy Ch Dept of CSE
Characteristics

total participation:
Topic 10
• If a company policy states that every
employee must work for a department, then
ER Model an employee entity can exist only if it
participates in at least one WORKS_FOR
relationship instance Thus, the participation
of EMPLOYEE in WORKS_FOR is called
total participation, meaning that every entity
in "the total set" of employee entities must be
related to a department entity via
WORKS_FOR. Total participation is also
called existence dependency.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Partial participation:

• We do not expect every employee to manage


a department, so the participation of
Topic 10
EMPLOYEE in the MANAGES relationship
type is partial, meaning that some or "part of
ER Model
the set of" employee entities are related to
some department entity via MANAGES, but
not necessarily all.

[Link]
Venkata Rami Reddy Ch Dept of CSE
WEAK ENTITY TYPES

• Entity types that do not have key attributes of


their own are called weak entity types.
Topic 10 • In contrast, regular entity types that do have a
key attribute are also called strong entity types.
ER Model
• Entities belonging to a weak entity type are
identified by being related to specific entities from
another entity type in combination with one of
their attribute values
• Weak entity type always has a total participation
constraint (existence dependency) with respect
to its identifying relationship, because a weak
entity cannot be identified without an owner
entity.
[Link]
Venkata Rami Reddy Ch Dept of CSE
Company ER Diagram

ER DIAGRAM – Relationship Types are: WORKS_FOR,


MANAGES, WORKS_ON,
Topic 10 CONTROLS,SUPERVISION, DEPENDENTS_OF

ER Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
EER (Enhanced Entity Relationship)
Model
• The ER model is generally sufficient for
"traditional" database applications.
Topic 11 • But more recent applications of DB technology
(e.g., CAD/CAM, telecommunication,
EER Model images/graphics, multimedia, data
mining/warehousing, geographic info systems)
cry out for a richer model.

EER.mp4
• The EER (Enhanced ER) model includes all the
modeling concepts of the ER model ,In addition,
it includes the concepts of subclass and
superclass and the related concepts of
specialization and generalization.

[Link]
Venkata Rami Reddy Ch Dept of CSE
SUBCLASSES, SUPERCLASSES AND
INHERITANCE

•An entity type is used to represent both a type


of entity and the entity set or collection of
Topic 11
entities of that type that exist in the database.
EER Model
•Defining a new entity type from existing entity
types is called inheritance.
•New entity type is called subclass and
existing entity type is called superclass

[Link]
Venkata Rami Reddy Ch Dept of CSE
SUBCLASSES, SUPERCLASSES AND
INHERITANCE

Topic 11

[Link]
Venkata Rami Reddy Ch Dept of CSE
SUBCLASSES, SUPERCLASSES AND
INHERITANCE

• The set of entities in each of the latter


groupings is a subset of the entities that
Topic 11
belong to the EMPLOYEE entity set,
meaning that every entity that is a member of
one of these sub groupings is also an
employee.
• We call each of these sub groupings a
subclass of the EMPLOYEE entity type, and
the EMPLOYEE entity type is called the
super class for each of these subclasses

[Link]
Venkata Rami Reddy Ch Dept of CSE
SUBCLASSES, SUPERCLASSES AND
INHERITANCE
• The set of entities in each of the latter groupings is a
subset of the entities that belong to the EMPLOYEE
Topic 11 entity set, meaning that every entity that is a member of
one of these sub groupings is also an employee.
EER Model • We call each of these sub groupings a subclass of the
EMPLOYEE entity type, and the EMPLOYEE entity type
is called the super class for each of these subclasses
• We call the relationship between a super class and
anyone of its subclasses a super class/subclass or
simply class/subclass relationship.
• In our previous example, EMPLOYEE/SECRETARY
and EMPLOYEE/TECHNICIAN are two class/subclass
relationships.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Specialization

• Specialization is the process of defining a set


of subclasses of an entity type;
Topic 11
• That entity type is called the super class of
EER Model the specialization.
• The set of subclasses that form a
specialization is defined on the basis of some
distinguishing characteristic of the entities in
the super class
Specialization.m
p4

[Link]
Venkata Rami Reddy Ch Dept of CSE
Specialization

Topic 11

[Link]
Venkata Rami Reddy Ch Dept of CSE
Generalization

• The term generalization to refer to the


process of defining a generalized entity type
Topic 11
from the given entity types.
EER Model • Generalization a reverse process of
abstraction in which we suppress the
differences among several entity types,
identify their common features, and
generalize them into a single super class of
[Link] which the original entity types are special
4
subclasses.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Generalization
• Hence, in below Figure we can view {CAR,
TRUCK} as a specialization of VEHICLE, rather
Topic 11 than viewing VEHICLE as a generalization of
CAR and TRUCK.
EER Model • Similarly, in previous figure we can view
EMPLOYEE as a generalization of SECRETARY,
TECHNICIAN, and ENGINEER.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Generalization

Topic 11

NPTEL VIDEOS

[Link]
Venkata Rami Reddy Ch Dept of CSE
Generalization

Topic 11

EER Model

[Link]
Venkata Rami Reddy Ch Dept of CSE
Constraints on specialization

• Two Constraints on specialization are


Topic 11 1. Disjointness constraint
2. Completeness constraint,
EER Model
Disjointness constraint
• The first is the disjointness constraint,
which specifies that the subclasses of the
specialization must be disjoint.
• This means that an entity can be a member
of at most one of the subclasses of the
specialization.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Disjointness constraint

• Two Constraints on specialization are


Topic 11 1. Disjointness constraint
2. Completeness constraint,
EER Model
Disjointness constraint
• The first is the disjointness constraint,
which specifies that the subclasses of the
specialization must be disjoint.
• This means that an entity can be a member
of at most one of the subclasses of the
specialization.

[Link]
Venkata Rami Reddy Ch Dept of CSE
completeness constraint

• The second constraint on specialization is


Topic 11
called the completeness constraint, which
may be total or partial.
EER Model • A total specialization constraint specifies
that every entity in the superclass must be a
member of some subclass in the
specialization.
• For example, if every EMPLOYEE must be
either an HOURLY_EMPLOYEE or a
SALARIED_EMPLOYEE, then the
specialization {HOURLY_EMPLOYEE,
SALARIED_EMPLOYEE} of Figure is a total
[Link]
specialization of EMPLOYEE;
Venkata Rami Reddy Ch Dept of CSE
completeness constraint

• partial specialization, which allows an


entity not to belong to any of the subclasses.
Topic 11
For example, if some EMPLOYEE entities do
not belong to any of the subclasses
EER Model
{SECRETARY, ENGINEER, TECHNICIAN}
of Figure 04.01 and Figure 04.04, then that
specialization is partial

[Link]
Venkata Rami Reddy Ch Dept of CSE
completeness constraint

• partial specialization, which allows an


entity not to belong to any of the subclasses.
Topic 11
For example, if some EMPLOYEE entities do
not belong to any of the subclasses
EER Model
{SECRETARY, ENGINEER, TECHNICIAN}
of Figure 04.01 and Figure 04.04, then that
specialization is partial

[Link]
Venkata Rami Reddy Ch Dept of CSE
Assignment Questions:

• Discuss various disadvantages in the file system and


explain how it can be overcome by the database
system
• Explain the advantages of DBMS? What is DBA and
describe the responsibilities of DBA?
• Consider your own assumptions and draw an ER
model for “University Database”

[Link]
Venkata Rami Reddy Ch Dept of CSE
Assignment Questions:

• Construct an E – R diagram for the database of a hospital


with a set of patients and a set of doctors. With each patient
a log of the various test conducted is also associated.
Construct the appropriate relations for this diagram.
• Consider your own assumptions and draw an ER model for
“Sales Order Processing”.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Gate Questions

Consider the following ER diagram.(GATE-2008)

The minimum number of tables needed to represent M, N, P,


R1, R2 is
(A) 2
(B) 3
(C) 4
(D) 5

[Link]
Venkata Rami Reddy Ch Dept of CSE
Gate Questions

Answer (A)
Explanation:
Many-to-one and one-to-many relationship
sets that are total on the many-side can be
represented by adding an extra attribute to the
“many” side, containing the primary key of the
“one” side. Since R1 is many to one and
participation of M is total, M and R1 can be
combined to form the table {M1, M2, M3, P1}.
N is a week entity set, so it can be combined
with P.

[Link]
Venkata Rami Reddy Ch Dept of CSE
Gate Questions

Let E1 and E2 be two entities in an E/R diagram


with simple single-valued attributes. R1 and R2 are
two relationships between E1 and E2, where R1 is
one-to-many and R2 is many-to-many. R1 and R2
do not have any attributes of their own. What is the
minimum number of tables required to represent
this situation in the relational model?(GATE-2005)
(a) 2
(b) 3
(c) 4
(d) 5
Answer (c)

[Link]
Venkata Rami Reddy Ch Dept of CSE
Gate Questions

Given the basic ER and relational models,


which of the following is INCORRECT?
(GATE-2012)

(A) An attributes of an entity can have more than one


value
(B) An attribute of an entity can be composite
(C) In a row of a relational table, an attribute can have
more than one value
(D) In a row of a relational table, an attribute can have
exactly one value or a NULL value

[Link]
Venkata Rami Reddy Ch Dept of CSE
Gate Questions

Answer (C)
Explanation:
The term ‘entity’ belongs to ER model and the
term ‘relational table’ belongs to relational
model.
A and B both are true. ER model supports
both multi valued and composite attributes
(C) is false and (D) is true. In Relation model,
an entry in relational table can have exactly
one value or a NULL.

[Link]
Venkata Rami Reddy Ch Dept of CSE

You might also like