2. www.company.com
UNIT – I
• Database System- concepts and architecture,
Data modelling using the Entity Relationship
(ER) modelling and Enhanced Entity
Relationship (EER) modelling, Specialization
and Generalization.
Venkata Rami Reddy Ch Dept of CSE
3. www.company.com
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.
• To understanding the Specialization and
Generalization
Objectives:
Venkata Rami Reddy Ch Dept of CSE
4. www.company.com
UNIT-1
Outcomes::
Venkata Rami Reddy Ch Dept of CSE
• Students will able to know the DBMS
concepts and their importance.
• Students will able to design the databases for
any real time applications.
• Students will the constraints to be considered
while designing the databases
5. www.company.com
UNIT-1
Topics::
Venkata Rami Reddy Ch Dept of CSE
1. Introduction to Database Systems
2. File System
3. Advantages of DBMS
4. DBA, Designers and End users
5. Data Models
• Relational Model
• Entity-Relationship Model
• Hierarchical Model
• Network Model
• Object-Oriented Model
6. www.company.com
Contents
6. Levels of Abstraction or Three-Schema
architecture
7. DBMS architecture
8. CLASSIFICATION OF DATABASE
MANAGEMENT SYSTEMS
9. Phases of Database Design
Topics:
Venkata Rami Reddy Ch Dept of CSE
7. www.company.com
Contents
Topics:
Venkata Rami Reddy Ch Dept of CSE
10. Entity-Relationship model
• Types of Attributes
• Entity Types and Entity Sets:
• Notations of ER Diagrams
• Example Database Application
• Relationship:
• Degree of a Relationship Type
• Constraints on Relationships
9. www.company.com
• A data mean known facts or raw facts that can be
recorded and that have implicit meaning.
• For example, consider the names, telephone,
numbers, and addresses of the people you know.
You may have recorded this data in an indexed
address book, you may have stored it on a hard
drive, using a personal computer and software
such as Microsoft Access, or Excel.
• Information: Processed data.
Topic
Introduction to
Database
Systems
1
data
Venkata Rami Reddy Ch Dept of CSE
Introduction to Dbms
in
10. www.company.com
• Database is a large collection of related data that
can be stored generally describes activities of an
organization.Topic
Introduction to
Database Systems
1
Database
Venkata Rami Reddy Ch Dept of CSE
11. www.company.com
• It is used to store data of an organization.
• A database is designed and developed for a
specific purpose.
• It has some source from which data is derived and
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.
Topic
Introduction to
Database Systems
1
Database Properties
Venkata Rami Reddy Ch Dept of CSE
12. www.company.com
• A database management system (DBMS) is
a collection of programs (software) for
defining, creating, manipulating and
maintaining a database.
Topic
Introduction to
Database Systems
1
Database Management System
Venkata Rami Reddy Ch Dept of CSE
13. www.company.com
• The DBMS is a general-purpose software
package that facilitates the processes of
defining, constructing, manipulating, and
sharing databases among various users and
applications.
.
Topic
Introduction to
Database Systems
1
Database Management System
Venkata Rami Reddy Ch Dept of CSE
Purpose of DBMS
14. www.company.com
• Defining a database involves specifying the data
types, structures, and constraints for the data to
be stored in the database
• Manipulating a database includes functions
such as querying the database to retrieve
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.
Topic
Introduction to
Database Systems
1
Actions of DBMS
Venkata Rami Reddy Ch Dept of CSE
15. www.company.com
• Sharing a database allows multiple users and
programs to access the database
concurrently
Topic
Introduction to
Database Systems
1
Actions of DBMS
Venkata Rami Reddy Ch Dept of CSE
17. www.company.com
• Banking: all transactions
• Airlines: reservations, schedules
• Sales: customers, products,
purchases
• Online retailers: order tracking,
customized recommendations
Topic
Introduction to
Database Systems
1
Database Applications
Venkata Rami Reddy Ch Dept of CSE
18. www.company.com
• Manufacturing: production,
inventory, orders, supply chain
• Human resources: employee
records, salaries, tax deductions
• Universities: registration, grades
Topic
Introduction to
Database Systems
1
Database Applications:
Venkata Rami Reddy Ch Dept of CSE
19. www.company.com
• Before the evolution of DBMS, File
Systems are used to store and manage
the data.
• In File System data will be stored in
individual files.
• 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
Topic
File System
2
File System
Venkata Rami Reddy Ch Dept of CSE
20. www.company.com
• In the file processing approach, each
department would "own" a collection of
relevant data and software applications to
manipulate that data.
Topic
File System
2
File processing processing system
Venkata Rami Reddy Ch Dept of CSE
21. www.company.com
1. Data Redundancy and Inconsistency
2. Difficulty in accessing data
3. Data isolation
4. Enforcing Integrity constraints
5. Atomicity problems
6. Difficulty in concurrency control
7. Security Problems
Topic 2
Drawbacks of File System
Venkata Rami Reddy Ch Dept of CSE
File System
Dis advantages of
Filesystem
22. www.company.com
• Data isolation: The data is scattered in
different files and with different formats. 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.
In File System integrity constraints are set at
program level.
Topic
File System
2
Cont ...
Venkata Rami Reddy Ch Dept of CSE
23. www.company.com
Data Redundancy and Inconsistency:
• Data redundancy means appearing same
data in different places.
• In file system same information is stored at
different places it causes data-inconsistency
problems during updates.
Difficulty in accessing data:
• 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
Topic
File System
2
Cont ...
Venkata Rami Reddy Ch Dept of CSE
24. www.company.com
Atomicity problems:
• Atomicity is a property of a transaction it states that
either all actions to be performed or none.
• In file processing system incomplete transactions
cannot roll back. Due this data will be inconsistent.
Difficulty in concurrency control:
• concurrency means same file is updated by different
application programs at the same time.
• In File Processing System it is not possible to
handle concurrency because of that we can get
inconsistent data
Topic
File System
2
Cont ...
Venkata Rami Reddy Ch Dept of CSE
25. www.company.com
Security Problems:
• Since the information is scattered in different 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 data.
Topic
File System
2
Cont ...
Venkata Rami Reddy Ch Dept of CSE
26. www.company.com
1. Controlling Redundancy
2. Data Consistency
3. Data Security
4. Providing Storage Structures for Efficient Query
Processing
5. Providing Backup and Recovery
6. Providing concurrency control
7. Enforcing Integrity constraints
8. Report Writers
Topic
Advantages of
DBMS
3
Advantages of DBMS
Venkata Rami Reddy Ch Dept of CSE
DBMS Advantages
27. www.company.com
• In non-database systems (traditional computer file
processing), same data is stored in many places.
• Redundancy leads to several problems 1.duplication
effort: same data can be entered multiple times 2.
Storage space is wasted. 3. Data inconsistency.
• In DBMS, all the data of an organization is integrated
into a single database.
• By controlling the data redundancy, you can save
storage space
Topic
Advantages of
DBMS
3
Controlling Redundancy
Venkata Rami Reddy Ch Dept of CSE
28. www.company.com
• By controlling the data redundancy, the data
consistency is obtained.
• 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 immediately
available to all users.
• If the DBMS has reduced redundancy to a
minimum level, the database system enforces
consistency.
• It means that when a data item appears more than
once in the database and is updated, the DBMS
automatically updates each occurrence of a data
item in the database.
Topic
Advantages of
DBMS
3
Data Consistency:
Venkata Rami Reddy Ch Dept of CSE
29. www.company.com
• Data security is the protection of the database
from unauthorized users.
• Only the authorized persons are allowed to access
the database.
• Some of the users may be allowed to access only
a part of database i.e., the data that is related to
them or related to their department.
• Mostly, the DBA or head of a department can
access all the data in the database.
Topic
Advantages of
DBMS
3
Data Security
Venkata Rami Reddy Ch Dept of CSE
30. www.company.com
• Some users may be permitted only to retrieve
data, whereas others are allowed to retrieve
as well as to update data.
• The database access is controlled by the
DBA.
• He 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.
Topic
Advantages of
DBMS
3
Data Security
Venkata Rami Reddy Ch Dept of CSE
31. www.company.com
• Database systems must provide capabilities to
execute queries and updates efficiently
• Because the database is typically stored on disk, the
DBMS must provide specialized data structures to
speed up disk search for the desired records.
• Auxiliary files called indexes are used for this
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.
Topic
Advantages of
DBMS
3
Providing Storage Structures for Efficient Query
Processing
Venkata Rami Reddy Ch Dept of CSE
32. www.company.com
• Most of the DBMSs provide the 'backup and
recovery' sub-systems that automatically create the
backup of data and restore data if required.
• For example, if the computer system fails in the
middle (or end) of an update operation of the
program, the recovery sub-system is responsible for
making sure that the database is restored to the
state it was in before the program started executing.
Topic
Advantages of
DBMS
3
Providing Backup and Recovery
Venkata Rami Reddy Ch Dept of CSE
33. www.company.com
• DBMS will support concurrency control tools for
permitting multiple users or application programs to
access the database concurrently, while preserving
the consistency of database.
• .
Topic
Advantages of
DBMS
3
Providing concurrency control
Venkata Rami Reddy Ch Dept of CSE
34. www.company.com
• Integrity constraints can be applied to database so
that correct data can be entered in to database.
Ex: 1. minimum balance of a account is 1000
2. Max marks of a subject is 100
• 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.
Topic
Advantages of
DBMS
3
Enforcing Integrity constraints
Venkata Rami Reddy Ch Dept of CSE
35. www.company.com
• Most of the DBMSs provide the report writer tools
used to create reports. The users can create reports
very easily and quickly.
• Once a report is created, it can be used many times
and it can be modified very easily.
• The created reports are also saved along with
database and behave like a software component.
Topic
Advantages of
DBMS
3
Report Writers
Venkata Rami Reddy Ch Dept of CSE
37. www.company.com
• The database administrator is a person having central
control over data and programs accessing the data.
• DBA coordinates all the activities of the database
system
• They are the users who are most familiar with the
database and are responsible for creating, modifying,
and maintaining its three levels.
• Database Administrator is responsible to manage the
DBMS’s use and ensure that the database is
functioning
• DBA is responsible for granting permission to the
users of the database and stores the profile of each
user in the database
Topic
Database
Administrator
4
Database Administrator(DBA)
Venkata Rami Reddy Ch Dept of CSE
38. www.company.com
1. Installing and upgrading the database server
and application tools
2. Allocating system storage and planning future
storage requirements for the database system
3. Modifying the database structure, as
necessary, from information given by
application developers
4. Enrolling users and maintaining system
security
5. Ensuring compliance with database vendor
license agreement
6. Controlling and monitoring user access to the
database
Topic
DBA
4
Responsibilities of
Venkata Rami Reddy Ch Dept of CSE
39. www.company.com
7) Monitoring and optimizing the performance of
the database
8) Planning for backup and recovery of database
information
9) Maintaining archived data
10) Backing up and restoring databases
11) Contacting database vendor for technical support
12) Generating various reports by querying from
database as per need
Topic
Responsibilities
of DBA
4
Responsibilities of DBA
Venkata Rami Reddy Ch Dept of CSE
40. www.company.com
• Database designers are responsible for
identifying the data to be stored in the
database and for choosing appropriate
structures to represent and store this data.
• These tasks are mostly undertaken before
the database is actually implemented and
populated with It is the responsibility of
database 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.
Topic
Database Designers
4
Database Designers
Venkata Rami Reddy Ch Dept of CSE
41. www.company.com
• In many cases, the designers are on the
staff of the DBA and may be assigned
other staff responsibilities after the
database design is completed.
• Database designers typically interact with
each potential group of users and develop
views of the database that meet the data
and processing requirements of these
groups.
Topic
Database Designers
4
Database Designers
Venkata Rami Reddy Ch Dept of CSE
42. www.company.com
• End users are the people whose jobs
require access to the database for
querying, updating, and generating
reports; the database primarily exists for
their use.
• There are several categories of end
users:
• Casual end users
• Naive or parametric end users
• Sophisticated end users
• Stand-alone users
Topic
End Users
4
End Users
Venkata Rami Reddy Ch Dept of CSE
43. www.company.com
• Casual end users occasionally access the
database, but they may need different
information each time.
• They use a sophisticated database query
language to specify their requests and are
typically middle- or high-level managers or
other occasional browsers.
Topic
End Users
4
Casual end users
Venkata Rami Reddy Ch Dept of CSE
44. www.company.com
• Naive or parametric end users make up a sizable
portion of database end users.
• Their main job function is querying and updating
the database, using standard types of queries
and updates-called canned transactions-that have
been carefully programmed and tested.
• The tasks that such users perform are varied:
• 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
Topic
End Users
4
Naive or parametric end users
Venkata Rami Reddy Ch Dept of CSE
45. www.company.com
• Sophisticated end users include engineers, scientists,
business analysts, and others who thoroughly
familiarize themselves with the facilities of the DBMS
so as to implement their applications to meet their
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.
• An example is the user of a tax package that stores a
variety of personal financial data for tax purposes.
Topic
End Users
4
Sophisticated end users
Venkata Rami Reddy Ch Dept of CSE
46. www.company.com
• A data model is a collection of concepts that can be
used to describe the structure of a database.
• Structure of a database; mean the data types,
relationships, and constraints that should hold for the
data. Most data models also include a set of basic
operations for specifying retrievals and updates on
the database.
Types of Data Models
• Relational Model
• Entity-Relationship Model
• Hierarchical Model
• Network Model
• Object-Oriented Model
Topic
Data Models
5
Data Models
Venkata Rami Reddy Ch Dept of CSE
Database Models
47. www.company.com
• Most commonly used model is the relational model.
• In this model data is organized as two-dimensional tables.
• Each table is called relation.
• 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.
• The relational model is implemented in database where a
relation is represented by a table, a tuple is represented
by a row, and an attribute is represented by a column of
the table.
Topic
Types of Data
Models
5
Relational Model
Venkata Rami Reddy Ch Dept of CSE
48. www.company.com
• Entity-Relationship model is based on the notion of real
world entities and relationship among them.
• ER Model is best used for the conceptual design of
database.
• ER Model is based on:
• Entities and their attributes
• Relationships among entities
Topic
Types of Data
Models
5
Entity-Relationship Model
Venkata Rami Reddy Ch Dept of CSE
49. www.company.com
Entity
• An entity in ER Model is real world entity, which has some
properties called attributes. Every attribute is defined by its
set of values, called domain.
• For example, in a school database, a student is considered
as an entity. Student has various attributes like name, age
and class etc.
Topic
Types of Data
Models
5
Entity-Relationship Model
Venkata Rami Reddy Ch Dept of CSE
50. www.company.com
• A hierarchical data model is a data model which the
data is organized into a tree like structure.
• First commercial DBMS is based on this model.
• In Hierarchical model data is represented as records
and the records organized as collection of trees.
• The relationships among the data are represented by
links, which can be viewed as pointers.
Topic
Types of Data
Models
5
Hierarchical Model
Venkata Rami Reddy Ch Dept of CSE
51. www.company.com
Network Model
• In Network model data is represented as records and
the records organized as collection of arbitrary graphs.
• The relationships among the data are represented by
links, which can be viewed as pointers.
• In network model a record can have any number of
parent records.
Topic
Types of Data
Models
5
Network Model
Venkata Rami Reddy Ch Dept of CSE
52. www.company.com
• Database Schema refers to the overall structure of a database.
• The description of a database is called the database schema,
which is specified during database design and is not expected
to change frequently
Schema Diagram:
Student
Course
Teacher
Sub topic 5
Schemas, Instances, and Database
State
Venkata Rami Reddy Ch Dept of CSE
Schema
53. www.company.com
• The data in the database at a particular moment in time
is called instance or database state.
• The distinction between database schema and
database state is very important.
Database state:
• At any point in time, the database has a current state.
subTopic
instance
5
Instance:
Venkata Rami Reddy Ch Dept of CSE
55. www.company.com
• The internal schema uses a physical data model and
describes the complete details of data storage and
access paths for the database.
• It tells us what data is stored in the database and how.
At least the following aspects are considered at this
level:
• Storage allocation: B-trees, hashing etc.
• Access paths: specification of primary and secondary
keys, indexes and pointers and sequencing..
Topic
Three-Schema
architecture
6
Internal level or internal schema:
Venkata Rami Reddy Ch Dept of CSE
56. www.company.com
• The conceptual level has a conceptual schema, which
describes the structure of the whole database for a
community of users.
• The conceptual schema hides the details of 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.
Topic
Three-Schema
architecture
6
Conceptual level or conceptual schema
Venkata Rami Reddy Ch Dept of CSE
57. www.company.com
External level or External View:
• The external or view level includes a number of external
schemas or user views.
• The external level is the view that the 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.
Topic
Three-Schema
architecture
6
External level or External View:
Venkata Rami Reddy Ch Dept of CSE
58. www.company.com
• Data independence can be defined as the capacity to
change the schema at one level of a database system
without having to change the schema at the next higher
level.
• We can define two types of data independence:
1 Physical data independence
2. Logical data independence
Topic
Three-Schema
architecture
6
Data Independence
Venkata Rami Reddy Ch Dept of CSE
59. www.company.com
• Physical data independence is the capacity to
change the internal schema without having to
change the conceptual schema.
• Hence, the external schemas need not be
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.
Topic
Three-Schema
architecture
6
Physical data independence:
Venkata Rami Reddy Ch Dept of CSE
60. www.company.com
• Logical data independence is the capacity to
change the conceptual schema without
having to change external schema or
application programs.
• 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).
Topic
Three-Schema
architecture
6
Logical data independence:
Venkata Rami Reddy Ch Dept of CSE
61. www.company.com
The Functional components of a database system can be
divided in to
• Query Processor Components
• Storage Manager Components
Topic
DBMS architecture
7
DBMS architecture
Venkata Rami Reddy Ch Dept of CSE
63. www.company.com
The Query Processor Components include:
DDL interpreter:
• It interprets DDL statements and converts them in to a
set tables which are saved in the data 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.
Topic
DBMS architecture
7
Query Processor Components
Venkata Rami Reddy Ch Dept of CSE
64. www.company.com
• These components provide the interface between the
low-level data stored in the database and the Query
Processor.
• The storage manager components include:
Authorization and integrity manager:
• It tests for the satisfaction of integrity constraints and
checks the authority of users to access data.
Transaction manager:
• This component ensures that concurrent transactions
proceed without conflict and the database remains in a
consistent (correct) state despite system failures.
Topic
DBMS architecture
7
Storage Manager Components
Venkata Rami Reddy Ch Dept of CSE
65. www.company.com
File manager:
• It manages the allocation of disk-space for the
storage of DBMS files.
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.
Topic
DBMS architecture
7
Storage Manager Components
Venkata Rami Reddy Ch Dept of CSE
66. www.company.com
Data files:
• Which store the database itself.
Data dictionary:
• It is a metadata file, which stores the database
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. This information is used by the
Query Processor to optimize the queries.
Topic
DBMS architecture
7
Data Components
Venkata Rami Reddy Ch Dept of CSE
67. www.company.com
Several criteria are normally used to classify DBMSs are
1. Based on data model
2. No of users supported by the System
3. Number of sites over which the database is distributed
4. Cost
5. Types of access path options
6. Based on purpose
Topic
CLASSIFICATION
OF DATABASE
MANAGEMENT
SYSTEMS
8
CLASSIFICATION OF DATABASE
MANAGEMENT SYSTEMS
Venkata Rami Reddy Ch Dept of CSE
68. www.company.com
• The main data model used in many current
commercial DBMSs is the relational data model.
• The object data model was implemented in some
commercial systems but has not had widespread use.
• 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.
Topic
CLASSIFICATION
OF DATABASE
MANAGEMENT
SYSTEMS
8
1.Based on Data Model:
Venkata Rami Reddy Ch Dept of CSE
69. www.company.com
Multi-user vs. single-user
• Single-user systems support only one user at a time
and are mostly used with Personal computers.
• Multiuser systems, support multiple users concurrently.
Topic
CLASSIFICATION
OF DATABASE
MANAGEMENT
SYSTEMS
8
2.No of users supported by the System::
Venkata Rami Reddy Ch Dept of CSE
70. www.company.com
Centralized vs. distributed
• A DBMS is centralized if the data is stored at a single
computer site. A centralized DBMS can support multiple
users, but the DBMS and the database themselves reside
totally at a single computer site.
• A distributed DBMS (DDBMS) can have the actual
database and DBMS software distributed over many sites,
connected by a computer network.
Topic
CLASSIFICATION
OF DATABASE
MANAGEMENT
SYSTEMS
8
3. Number of sites over which the database is
distributed
Venkata Rami Reddy Ch Dept of CSE
71. www.company.com
• The majority of DBMS packages cost between $10,000 and
$100,000.
• Single-user low-end systems that work with micro computers
cost between $100 and $3000. At the other end of the scale, a
few elaborate packages cost more than $100,000.
Topic
CLASSIFICATION
OF DATABASE
MANAGEMENT
SYSTEMS
8
4. Cost
Venkata Rami Reddy Ch Dept of CSE
72. www.company.com
• We can also classify a DBMS on the basis of the types
of access path options for storing files. One well-known
family of DBMSs is based on inverted file structures.Topic
CLASSIFICATION
OF DATABASE
MANAGEMENT
SYSTEMS
8
5. Access path
Venkata Rami Reddy Ch Dept of CSE
73. www.company.com
• A DBMS can be general purpose or special purpose.
When performance is a primary
• Consideration, a special-purpose DBMS can be
designed and built for a specific application such a
system cannot be used for other applications without
major changes.
• Many airline reservations and telephone directory
systems developed in the past are special purpose
DBMSs.
Topic
CLASSIFICATION OF
DATABASE
MANAGEMENT
SYSTEMS
8
6. General-purpose vs. special-purpose
Venkata Rami Reddy Ch Dept of CSE
74. www.company.com
Topic
Phases of
Database Design
9
Phases of Database Design
Venkata Rami Reddy Ch Dept of CSE
Requirements collection
and analysis
Conceptual Design
Logical Design
Data Model Mapping
Physical Design
Phases of Database Design
75. www.company.com
• In this step, the database designers interview
prospective database users to understand and
document their data requirements.
• These requirements should be specified in as
detailed and complete a form as possible
Topic
Phases of
Database Design
9
Requirements collection and analysis
Venkata Rami Reddy Ch Dept of CSE
76. www.company.com
• Once all the requirements have been collected
and analyzed, the next step is to create a
conceptual schema for the database; using a high-
level conceptual data model this step is called
conceptual 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.
Topic
Phases of
Database Design
9
Conceptual Design
Venkata Rami Reddy Ch Dept of CSE
77. www.company.com
• The next step in database design is the actual
implementation of the database, using a commercial
DBMS.
• Most current commercial DBMSs use an
implementation data model such as the relational or
the object-relational database model.
• In this phase the conceptual schema is transformed
from the high-level data model into the implementation
data model
Topic
Phases of
Database Design
9
Logical Design
Venkata Rami Reddy Ch Dept of CSE
78. www.company.com
Physical Design
• The last step is the physical design phase, during which
the internal storage structures, indexes, access paths, and
file organizations for the database files are specified.
Topic
Phases of
Database Design
9
Characteristics
Venkata Rami Reddy Ch Dept of CSE
79. www.company.com
• Entity-Relationship model is a popular high, level
conceptual data model. This model and its variations
are frequently used for the conceptual design of
Database applications
• The ER model describes data as entities, relationships,
and attributes.
• ER Model is best used for the conceptual design of
database.
• ER Model is based on: Entities and their attributes,
Relationships among entities
Topic
ER Model
10
Entity-Relationship model
Venkata Rami Reddy Ch Dept of CSE
ER-Model
80. www.company.com
• An entity, which is a "thing" in the real world
with an independent existence.
• An entity may be an object with a physical
existence (for example, a particular person,
car, house, or employee) or it may be an
object with a conceptual existence (for
example, a company, a job, or a university
course)
• In the University database context, an
individual student, faculty member, a class
room, a course are entities
Topic
ER Model
10
Entity:
Venkata Rami Reddy Ch Dept of CSE
ER-Model
81. www.company.com
• Attribute describes property or characteristics of an
entity
• These are the properties of the entity.
• 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
Types of Attributes
1. simple versus composite
2. single-valued versus multivalued
3. stored versus derived.
Topic
ER Model
Entity_20Relation
ship_20Model_mo
dule4_-1_PIP.mp4
10
Attributes
Venkata Rami Reddy Ch Dept of CSE
82. www.company.com
• Composite attributes can be divided into smaller
subparts, which represent more basic attributes with
independent meanings.
• For example, the Address attribute of the employee
entity can be subdivided into 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
Topic
ER Model
10
Composite versus Simple (Atomic) Attributes
Venkata Rami Reddy Ch Dept of CSE
83. www.company.com
• Single-valued attribute is the attribute which is having
only single value.
• Most attributes have a single value for a particular
entity; such attributes are called 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.
Topic
ER Model
10
Single-Valued versus Multivalued Attributes
Venkata Rami Reddy Ch Dept of CSE
84. www.company.com
• Derived attribute is one whose value can be
calculated/derived from the values of other
attributes. The Age and BirthDate attributes of a
person.
• 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.
Topic
ER Model
10
Stored versus Derived Attributes
Venkata Rami Reddy Ch Dept of CSE
85. www.company.com
• An entity type defines a collection (or set) of
entities that have the same attributes.
• Each entity type in the database is described
by its name and attributes.
• 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.
Topic
ER Model
10
Entity Types and Entity Sets
Venkata Rami Reddy Ch Dept of CSE
86. www.company.com
• The collection of all entities of a particular
entity type in the database at any point in time
is called an entity set.
• The entity set is usually referred to using the
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
Topic
ER Model
10
Entity Types and Entity Sets
Venkata Rami Reddy Ch Dept of CSE
87. www.company.com
• An important constraint on the entities of an
entity type is the key or uniqueness constraint
on attributes.
• An entity type usually has an attribute 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 uniquely.
• For example, the Name attribute is a key of the
COMPANY entity type because no two
companies are allowed to have the same
name.
• For the Employee entity type typical key
attribute is Empid.
Topic
ER Model
Mod_207.1.mp4
10
Key Attributes of an Entity Type
Venkata Rami Reddy Ch Dept of CSE
89. www.company.com
Example Database Application: COMPANY
• Initial Conceptual Design of COMPANY database
• Suppose that Requirements Collection and Analysis
results in the following (informal) description of the
COMPANY mini world:
• The company is organized as a collection of
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)
• has a set of employees assigned to it
• controls a set of projects
Topic
ER Model
10
Example Database Application: COMPANY
Venkata Rami Reddy Ch Dept of CSE
90. www.company.com
Each project
• has a unique name
• has a unique number
• has a single location
• 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
(s)he is a dependent
Topic
ER Model
10
Cont ...
Venkata Rami Reddy Ch Dept of CSE
91. www.company.com
Each employee
• has a name
• has a SSN that uniquely identifies her/him
• has an address
• 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)
Topic
ER Model
10
Cont ...
Venkata Rami Reddy Ch Dept of CSE
93. www.company.com
• It is Association among two or more
entities.
• When two or more entities are associated
with each other, we have an instance of a
Relationship.
• 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
refers to an entity (of the same or different
entity type), we say that a relationship exists
between the two entity types
Topic
ER Model
Relationships.mp4
10
Relationship:
Venkata Rami Reddy Ch Dept of CSE
95. www.company.com
• Relationships of the same type are grouped
or typed into a relationship type.
• For example, the WORKS_ON relationship
type in which EMPLOYEEs and PROJECTs
participate, or the MANAGES relationship
type in which EMPLOYEEs and
DEPARTMENTs participate.
.
Topic
ER Model
10
Relationship Type:
Venkata Rami Reddy Ch Dept of CSE
97. www.company.com
• The degree of a relationship is the number of
participating entities.
• It refers to number of entity sets that participate
in a relationship set.
• 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.
Topic
ER Model
10
Degree of a Relationship Type
Venkata Rami Reddy Ch Dept of CSE
98. www.company.com
• A relationship type can have attributes describing
properties of a relationship.
• FOR EXAMPLE Ramireddy works for CSE
Department since 2011
• WOEKS-FOR relationship type have attributes like
empid, deptid and since.
Topic
ER Model
10
Relationship Attributes
Venkata Rami Reddy Ch Dept of CSE
99. www.company.com
• Relationship types usually have certain
constraints that limit the possible
combinations of entities that may participate
in the corresponding relationship set.
• 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.
Topic
ER Model
10
Constraints on Relationships
Venkata Rami Reddy Ch Dept of CSE
100. www.company.com
• The cardinality ratio for a binary relationship
specifies the maximum number of
relationship instances that an entity can
participate in.
• 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.
Topic
ER Model
10
Cardinality Ratios for Binary Relationships
Venkata Rami Reddy Ch Dept of CSE
101. www.company.com
For a binary relationship set the mapping cardinality must be
one of the following types:
• One to One(1:1)
• 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
Topic
ER Model
10
Cardinality Ratios for Binary Relationships
Venkata Rami Reddy Ch Dept of CSE
102. www.company.com
• An entity in A is associated with at most one entity in
B, and an entity in B is associated with at most one entity
in A.
• An example of a 1:1 binary relationship is 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.
Topic
ER Model
10
One to One (1:1)
Venkata Rami Reddy Ch Dept of CSE
103. www.company.com
• 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.
• Many to One: An entity in A is associated with at
most one entity in B, an entity in B is associated with
many entities in A.
• Ex: an employee works in a single department but a
department consists of many employees.
Topic
ER Model
10
Cardinality Ratios
Venkata Rami Reddy Ch Dept of CSE
104. www.company.com
• Many to Many: An entity in A is associated with many
entities in B, and an entity in B is associated with many
entities in A.
• Ex: The relationship type WORKS_ON is of cardinality
ratio M:N, because the mini-world rule is that an
employee can work on several projects and a project
can have several employees.
Topic
ER Model
10
Cardinality Ratios
Venkata Rami Reddy Ch Dept of CSE
105. www.company.com
• This constraint specifies the minimum number
of relationship instances that each entity can
participate in, and is sometimes called the
minimum cardinality constraint.
• There are two types of participation constraints
1 total participation
2. Partial participation
Topic
ER Model
10
Participation Constraints
Venkata Rami Reddy Ch Dept of CSE
106. www.company.com
total participation:
• If a company policy states that every
employee must work for a department, then
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.
Topic
ER Model
10
Characteristics
Venkata Rami Reddy Ch Dept of CSE
107. www.company.com
• We do not expect every employee to manage
a department, so the participation of
EMPLOYEE in the MANAGES relationship
type is partial, meaning that some or "part of
the set of" employee entities are related to
some department entity via MANAGES, but
not necessarily all.
Topic
ER Model
10
Partial participation:
Venkata Rami Reddy Ch Dept of CSE
108. www.company.com
• Entity types that do not have key attributes of
their own are called weak entity types.
• In contrast, regular entity types that do have a
key attribute are also called strong entity types.
• 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.
Topic
ER Model
10
WEAK ENTITY TYPES
Venkata Rami Reddy Ch Dept of CSE
109. www.company.com
ER DIAGRAM – Relationship Types are: WORKS_FOR,
MANAGES, WORKS_ON,
CONTROLS,SUPERVISION, DEPENDENTS_OFTopic
ER Model
10
Company ER Diagram
Venkata Rami Reddy Ch Dept of CSE
110. www.company.com
• The ER model is generally sufficient for
"traditional" database applications.
• But more recent applications of DB technology
(e.g., CAD/CAM, telecommunication,
images/graphics, multimedia, data
mining/warehousing, geographic info systems)
cry out for a richer model.
• 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.
Topic
EER Model
EER.mp4
11
EER (Enhanced Entity Relationship)
Model
Venkata Rami Reddy Ch Dept of CSE
111. www.company.com
• Another concept included in the EER model is that of a
category or union type which is used to represent a
collection of objects that is the union of objects of
different entity types
Topic
EER Model
11
EER (Enhanced Entity Relationship)
Model
Venkata Rami Reddy Ch Dept of CSE
112. www.company.com
• An entity type is used to represent both a type of
entity and the entity set or collection of entities of that
type that exist in the database.
• For example, the entity type EMPLOYEE describes
the type (that is, the attributes and relationships) of each
employee entity, and also refers to the current set of
EMPLOYEE entities in the COMPANY database.
Topic
EER Model
11
SUBCLASSES, SUPERCLASSES AND
INHERITANCE
Venkata Rami Reddy Ch Dept of CSE
113. www.company.com
• An entity type is used to represent both a type of entity
and the entity set or collection of entities of that type that
exist in the database.
• For example, the entity type EMPLOYEE describes
the type (that is, the attributes and relationships) of each
employee entity, and also refers to the current set of
EMPLOYEE entities in the COMPANY database.
Topic
EER Model
11
SUBCLASSES, SUPERCLASSES AND
INHERITANCE
Venkata Rami Reddy Ch Dept of CSE
114. www.company.com
• The set of entities in each of the latter groupings is a
subset of the entities that 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
• 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.
Topic 11
SUBCLASSES, SUPERCLASSES AND
INHERITANCE
Venkata Rami Reddy Ch Dept of CSE
115. www.company.com
• The set of entities in each of the latter groupings is a
subset of the entities that 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
• 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.
Topic
EER Model
11
SUBCLASSES, SUPERCLASSES AND
INHERITANCE
Venkata Rami Reddy Ch Dept of CSE
116. www.company.com
• Specialization is the process of defining a set
of subclasses of an entity type;
• That entity type is called the super class of
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
Topic
EER Model
Specialization.m
p4
11
Specialization
Venkata Rami Reddy Ch Dept of CSE
119. www.company.com
The specialization process allows us to do
the following:
• Define a set of subclasses of an entity type
• Establish additional specific attributes with
each subclass
• Establish additional specific relationship
types between each subclass and other
entity types or other subclasses
Topic
EER Model
11
specialization
Venkata Rami Reddy Ch Dept of CSE
120. www.company.com
• The term generalization to refer to the
process of defining a generalized entity type
from the given entity types.
• 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
which the original entity types are special
subclasses.
Topic
EER Model
Generalization.mp
4
11
Generalization
Venkata Rami Reddy Ch Dept of CSE
121. www.company.com
• Hence, in below Figure we can view {CAR,
TRUCK} as a specialization of VEHICLE, rather
than viewing VEHICLE as a generalization of
CAR and TRUCK.
• Similarly, in previous figure we can view
EMPLOYEE as a generalization of
SECRETARY, TECHNICIAN, and ENGINEER.
Topic
EER Model
11
Generalization
Venkata Rami Reddy Ch Dept of CSE
124. www.company.com
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”
Venkata Rami Reddy Ch Dept of CSE
125. www.company.com
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”.
Venkata Rami Reddy Ch Dept of CSE
126. www.company.com
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
Venkata Rami Reddy Ch Dept of CSE
127. www.company.com
Gate Questions
Venkata Rami Reddy Ch Dept of CSE
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.
128. www.company.com
Gate Questions
Venkata Rami Reddy Ch Dept of CSE
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)
129. www.company.com
Gate Questions
Venkata Rami Reddy Ch Dept of CSE
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
130. www.company.com
Gate Questions
Venkata Rami Reddy Ch Dept of CSE
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.