0% found this document useful (0 votes)
101 views36 pages

Unit 1 DBMS R23

This document provides an overview of Database Management Systems (DBMS), including key concepts such as data, information, and knowledge, as well as the differences between file systems and DBMS. It discusses various types of database users, the importance of data independence, and the architecture of DBMS, including centralized and client-server models. Additionally, it highlights the benefits of using a DBMS for data management and processing.

Uploaded by

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

Unit 1 DBMS R23

This document provides an overview of Database Management Systems (DBMS), including key concepts such as data, information, and knowledge, as well as the differences between file systems and DBMS. It discusses various types of database users, the importance of data independence, and the architecture of DBMS, including centralized and client-server models. Additionally, it highlights the benefits of using a DBMS for data management and processing.

Uploaded by

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

lOMoARcPSD|53142443

DBMS UNIT-I R23 - dbms unit -i r23 jntuk

Information Technology (Jawaharlal Nehru Technological University, Kakinada)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by DEVARAJU PUTCHIGALLA ([email protected])
lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

UNIT I
Introduction: Database system, Characteristics (Database Vs File System), Database Users, Advantages
of Database systems, Database applications. Brief introduction of different Data Models; Concepts of
Schema, Instance and data independence; Three tier schema architecture for data independence;
Database system structure, environment, Centralized and Client Server architecture for the database.
Entity Relationship Model: Introduction, Representation of entities, attributes, entity set, relationship,
relationship set, constraints, sub classes, super class, inheritance, specialization, generalization using ER
Diagrams.

Data
The raw facts are called as data. The word “raw” indicates that they have not been processed.
Examples:
Ages of employees: 25; 29; 45; 23; 60; 51; 35 …
Names of employees: Ben; Anna: Mark; Kathy; Rose; Jack; Jane …
Information
The processed data is known as information.
Ex: Ages of Employees: Ben is 25 yrs old; Anna is 29 yrs old; Mark is 45 yrs old; Kathy is 35
yrs old; Rose is 60 yrs old; while Jack is 51 yrs old…
Knowledge
knowledge is the awareness or the conscious understanding of information or a concept
1. Knowledge refers to the practical use of information.
2. Knowledge necessarily involves a personal experience.
Example: Our employees Ben, Anna, and Kathy are still young and they are prospective
leaders of the firm.
DATA/INFORMATION PROCESSING:
The process of converting the data (raw facts) into meaningful information is called as
data/information processing.

File: The collection of data is called a file that is stored in the computer with a file name.
These files are managed by the File Based system.
File Based Systems
File is a collection of data which is stored in computer. Each file has a specific
format. The files are managed by File system.
A file system is a technique of arranging the files in a storage medium like a hard disk, pen
drive, DVD, etc. It helps you to organizes the data and allows easy retrieval of files when they
are required. It mostly consists of different types of files like mp3, mp4, txt, doc, etc. that are
grouped into directories. File systems consist of different files which are grouped into
directories.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

Problems:
 No standards
 Data duplication
 Data dependence
 No way to generate ad hoc queries
 No provision for security, recovery, concurrency, etc.
To overcome these problems the Data base system was implemented.

Difference between File System and DBMS:


Basis File System DBMS

The file system is software that manages


and organizes the files in a storage medium DBMS is software for managing
Structure within a computer. the database.

Data Redundant data can be present in a file In DBMS there is no redundant


Redundancy system. data.

Backup and It doesn’t provide backup and recovery of It provides backup and recovery
Recovery data if it is lost. of data even if it is lost.

Query There is no efficient query processing in the Efficient query processing is


processing file system. there in DBMS.

There is more data consistency


There is less data consistency in the file because of the process of
Consistency system. normalization.

It has more complexity in


handling as compared to the file
Complexity It is less complex as compared to DBMS. system.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

Basis File System DBMS

DBMS has more security


Security File systems provide less security in mechanisms as compared to file
Constraints comparison to DBMS. systems.

It has a comparatively higher


Cost It is less expensive than DBMS. cost than a file system.

Data In DBMS data independence


Independence There is no data independence. exists.

Multiple users can access data at


User Access Only one user can access data at a time. a time.

DATABASE SYSTEM
A database is an organized collection of structured data, typically stored electronically in a
computer system.
A database is usually controlled by a database management system (DBMS). Together, the data
and the DBMS, along with the applications that are associated with them, are referred to as a
database system, often shortened to just database.

Example Databases:

• Medical records
• Bank accounts
• Stock control
• Personnel systems
• Product catalogues
• Telephone directories
• Train timetables
Why Database?
A Data Base Management System is a system software for easy, efficient and reliable data processing and
management.
A database system consists of
 Data (the database)
 Software
 Hardware
 Users

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

It can be used for:


 Creation of a database.
 Retrieval of information from the database.
 Updating the database.
 Managing a database.

Benefits of Database Approach:


The data can saved
 Redundancy can be reduced
 In-consistency can be avoided
 Transaction support can be provided
 Integrity can be maintained
 Security can be enforced
 Conflicting requirements can be balanced
 Standards can be enforced

1) Processing Queries and Object Management:


2) Controlling redundancy and inconsistency:
3) Efficient memory management and indexing:
4) Concurrency control and transaction management:
5) Access Control and ease in accessing data:
6) Integrity constraints:
Applications of DBMS
Applications of DBMS: There are various fields where a database management system is
used. Following are some applications which make use of the database management
system:

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

DATABASE USERS
In large organizations, many people are involved in the design, use, and maintenance of a large
database with hundreds of users. The people whose jobs involve the day-to-day use of a large
database; we call them the actors on the scene.
we consider people who may be called workers behind the scene—those who work to maintain
the database system environment but who are not actively interested in the database contents as
part of their daily job.
Database users are categorized based up on their interaction with the data base.
These are seven types of data base users in DBMS.
1. Database Administrator (DBA) :

 Database Administrator (DBA) is a person/team who defines the schema and also
controls the 3 levels of database.

 The DBA will create a user account id and password for the user if he/she need to access
the data base.

 DBA is responsible for providing security to the data base and allows only the authorized
users to access/modify the data base.

 DBA monitors the recovery and back up and provide technical support.

 The DBA has a DBA account in the DBMS which called a system or superuser account.

 DBA repairs damage caused due to hardware and/or software failures.


2. Naive / End Users :
End Users are the unsophisticated who don’t have any DBMS knowledge but they frequently
use the data base applications in their daily life to get the desired results.
For examples, Railway’s ticket booking users are naive users. Clerks in any bank is a naive
user because they don’t have any DBMS knowledge but they still use the database and
perform their given task.
3. System Analyst :
System Analyst is a user who analyzes the requirements of parametric end users. They check
whether all the requirements of end users are satisfied.
4. Sophisticated Users :
Sophisticated users can be engineers, scientists, business analyst, who are familiar with the
database. They can access the database by using their own sql queries.
5. Data Base Designers :
Data Base Designers are the users who design the structure of data base which includes
tables, indexes, views, constraints, triggers, stored procedures. He/she controls what data
must be stored and how the data items to be related.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

6. Application Programmer :
Application Program are the back end programmers who writes the code for the application
programs.They are the computer professionals. These programs could be written in
Programming languages such as Visual Basic, Developer, C, FORTRAN, COBOL etc.
7. Casual Users / Temporary Users :
Casual Users are the users who occasionally use/access the data base .

Actors on the Scene


In large organizations, many people are involved in the design, use, and maintenance of a large
database with hundreds of users. The people whose jobs involve the day-to-day use of a large
database; we call them the actors on the scene.
Example:
1. Database Administrators
2. Database Designers
3. End Users
4. System Analysts and Application Programmers
Workers behind the Scene
In addition to those who design, use, and administer a database, others are associated with the
design, development, and operation of the DBMS software and system environment. These
persons are typically not interested in the database content itself. We call them the workers
behind the scene.
Example:
1. DBMS system designers and implementers
2. Tool developers
3. Operators and maintenance personnel

Concepts of Schema
A schema can be defined as the design of a database. The overall description of the database is
called the database schema.
The schema also called as Blue Print or skeleton of the database.
It can be categorized into three parts. These are:
1. Physical Schema 2. Logical Schema 3. View Schema

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

Physical Schema: It specifies physical storage structure of the database.


It is used to define that how the data will be stored in a block.
The physical level is used to describe complex low-level data structures in detail.
Logical Schem(Conceptual schema):This schema defines all the logical constraints that need to
be applied on the data stored. It defines tables, views, and integrity constraints.
View schema(External Schema): It can be defined as the design of the database at the view
level, which generally describes end-user interaction with database systems.

DBMS Instance
The data stored in database at a particular moment of time is called instance of database.
Database schema defines the variable declarations in tables that belong to a particular database;
the value of these variables at a moment of time is called the instance of that database.
For example, lets say we have a single table student in the database, today the table has 100
records, so today the instance of the database has 100 records.

Data Independence
Data Independence is defined as a property of DBMS that helps you to change the Database
schema at one level of a database system without requiring to change the schema at the next
higher level.
Data independence helps you to keep data separated from all programs that make use of it.

Types of Data Independence


In DBMS there are two types of data independence

1. Physical data independence


2. Logical data independence.

Logical Data Independence


Logical Data Independence is the ability to change the conceptual scheme without changing
1. External views

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

2. External API or programs


Any change made will be absorbed by the mapping between external and conceptual levels.
Examples of changes under Logical Data Independence
Due to Logical independence, any of the below change will not affect the external layer.
1. Add/Modify/Delete a new attribute, entity or relationship is possible without a rewrite of
existing application programs
2. Merging two records into one
3. Breaking an existing record into two or more records
Physical Data Independence
Physical data independence helps you to separate conceptual levels from the internal/physical
levels. Physical data independence is the power to change the physical data without impacting
the schema or logical data.

Examples of changes under Physical Data Independence


Due to Physical independence, any of the below change will not affect the conceptual layer.
 Using a new storage device like Hard Drive or Magnetic Tapes
 Modifying the file organization technique in the Database
 Switching to different data structures.
 Changing the access method.
 Modifying indexes.
 Changes to compression techniques or hashing algorithms.
 Change of Location of Database from say C drive to D Drive
Importance of Data Independence
 Helps you to improve the quality of the data
 Database system maintenance becomes affordable
 Enforcement of standards and improvement in database security
 You don't need to alter data structure in application programs
 Permit developers to focus on the general structure of the Database rather than worrying
about the internal implementation
 Easily make modifications in the physical level is needed to improve the performance of
the system. 

DBMS Architectures
DBMS architectures are 3 types:
Centralized DBMS(1-tier)
Client-Server Architecture (2-tier)
Client-Server Architecture (3-tier)

Centralized DBMS:
Combines everything into single system
includingDBMS software, hardware, application
programs, and user interface processing software.
User can still connect through a remote terminal –
however, all processing is done at centralized site.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

2-tier Client-Server Architectures:


The client/server architecture was
developed to deal with computing
environments in which a large number
of PCs, work stations, file servers,
printers, data base servers, web servers,
e-mail servers, and others are
connected via a network.

In this, software components are


distributed over two systems: client and server.
Clients:
Provide appropriate interfaces through a client software module to access and utilize the various
server resources.
DBMS Server:
DBMS Server provides database query and transaction services to the clients.
Applications running on clients utilize an Application Program Interface (API) to access server
databases via standard interface such as:
 ODBC : Open Database Connectivity standard
 JDBC: for Java programming access
 Client and server must install appropriate client module and server module software for
ODBC or JDBC
The user interface programs and application programs can run on the client side. When DBMS
access is required, the program establishes a connection to the DBMS, then client program can
communicate with DBMS.
Three Tier Client-Server Architecture:
Many web applications use an architecture called the 3-tier architecture, which adds an
intermediate layer between the client and database server as shown below.

The intermediate layer or middle layer is called Application Server or Web Server, depending
on the application.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

This server plays an intermediary role by running application programs and storing business
rules that are used to access data from the server.
It can also improve database security by checking client’s credentials before forwarding request
to the database server.
Figure (b) shows another architecture used by some other vendors. The layers in this are
Presentation, Business and Database services layers.
Advantages of Three-Tier Architecture :
1. The key three-tier benefit is improved scalability, since the application servers can be
deployed on many machines. Also, the database does not make longer connections with
every client – it only requires connections from a smaller number of application servers.
2. It improves data integrity. Here, all the updated information goes through the second
tier. The second tier can ensure that only important information is allowed to be updated in
the database and the risk of unreliable client applications corrupting information is
removed.
3. Security is improved since the client does not have direct access to the database; it is
more difficult for a client to obtain unauthorized data. Business logic is more secure
because it is stored on a secure central server.
4. Balancing of load is much easier with division of core business from the server of the
database.

Disadvantages of Three-Tier Architecture:


1. It is more complex than the 2-tier client-server computing model, because it is more
difficult to build a 3-tier application compared to a 2-tier application. The points of
communication are doubled.
2. The client does not maintain a persistent database connection.
3. A separate proxy server may be required.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

DATABASE SYSTEM STRUCTURE:


A database system is partitioned into modules that deal with each of the responsibilities of the
overall system.

The database system have 4 components:


1) Database users
2) Query processor
3) Storage manager
4) Disk Storage
The query processor is important because it helps the database system simplify and facilitate
access to data. The storage manager is important because databases typically require a large
amount of storage space.
Database Users:
Users are differentiated by the way they expect to interact with the system:

 Naive users are interact with the system by invoking one of the application programs that
have been written previously.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Database Management System UNIT-I B.Tech II Year II Sem

 Application programmers are computer professionals who write application programs.


Application programmers can choose from many tools to develop user interfaces.
 Sophisticated users interact with the system without writing programs. Instead, they form
their requests in a database query language.
 Coordinates all the activities of the database system. The database administrator interacts
with DBMS by using administration tools.

Query Processor:
The query processor will accept query from user and solves it by accessing the database.
Parts of Query processor:
 DDL interpreter
This will interprets DDL statements and fetch the definitions in the data dictionary.
 DML compiler
a. This will translates DML statements in a query language into low level instructions
that the query evaluation engine understands.
b. A query can usually be translated into any of a number of alternative evaluation plans
for same query result DML compiler will select best plan for query optimization.
 Query evaluation engine
This engine will execute low-level instructions generated by the DML compiler on
DBMS.
Storage Manager:

 A storage manager is a program module which acts like interface between the data stored
in a database and the application programs and queries submitted to the system.
 Thus, the storage manager is responsible for storing, retrieving and updating data in the
database.
 The storage manager components include:
o Authorization and integrity manager: Checks for integrity constraints and
authority of users to access data.
o Transaction manager: Ensures that the database remains in a consistent state
although there are system failures.
o File manager: Manages the allocation of space on disk storage and the data
structures used to represent information stored on disk.
o Buffer manager: It is responsible for retrieving data from disk storage into main
memory. It enables the database to handle data sizes that are much larger than the
size of main memory.
Disk Storage:
Disk storage is useful to store the actual database which maintains the following:

o Data files: Stored in the database itself.


o Data dictionary: Stores metadata about the structure of the database. The data
dictionary contains records about other objects in the database, such as
data ownership, data relationships to other objects, and other data.
o Indices: Provide fast access to data items.

KHIT, Guntur

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

E-R Model

E-R Model stands for Entity-Relationship Model, also known as E-R

Diagram. It was proposed by Peter Chen in 1971 to create a uniform convention

which can be used for relational database.

E-R model helps us to systematically analyze data requirements to produce a


well-designed database.

The ER model is used to define the conceptual view of database. The work of

the ER Model revolves around real-world entities and the associations between these

objects. At view level, the ER model is considered a good option for designing
databases.
Why we use ER Diagrams?
 Helps to describe entities, attributes, relationships.

 Provide a preview of how all your tables should connect, what fields are going

to be on each table.
 ER diagrams are translatable into relational tables which allow you to build
databases quickly.
 ER diagrams can be used by database designers as a blueprint for

implementing database.

 The database designer gains a better understanding about the database with
the help of ER diagram.
Advantages

 Simple: If we know the relationship between the attributes and the entities
we can easily build the ER Diagram for the model.
 Effective Communication Tool: This model is used widely by the database

designers for communicating their ideas.

 Easy Conversion to any Model: This model can be converted to any other
model like relational, network, hierarchical model etc.

Disadvantages
 No industry standard for notation: means one developer might use notations

Which are not understood by other developers.

B.ChandraSekhar@Dept. of IT,
Downloaded by DEVARAJU PUTCHIGALLA ([email protected])
lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


 Hidden information: As it is a high-level view so there are chances that some

details of information might be hidden.


Components of the ER Diagram
This model is based on three basic concepts:
1. Entities.
2. Attributes.

3. Relationships.

Notations

E-R Diagram is a visual representation of data that describes how data is related to

each other using different symbols and notations. Following are the major

components and its symbols in E- R Diagrams:


 Rectangle: This symbol represents entity types.

 Ellipse: This symbol represents attributes.


 Dashed Ellipse: This symbol represents derived attributes.

 Diamond: This symbol represents relationship types.

 Lines: It links attributes to entity types and entity types with other relationship

types.
 Primary key: attributes are underlined

 Double Ellipses: Represent multi-valued attributes


 Double Diamonds: Represent identifying relationship.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

Fig. Symbols used in E–R Model

Example ER diagram:

Entity and Entity Set

An entity is a real-world thing which is distinguishable from other. An entity can be

place, person, object, event or a concept. For example, in a company database,

employees, dealers, orders, and products can be considered as entities. Every entity is

made up of some 'attributes' which represent that entity. It is represented by a

rectangle.
Examples:

 Person: Employee, Student, Patient.


 Place: Store, Building.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


 Object: Machine, product, and Car.

 Event: Sale, Registration, Renewal.

 Concept: Account, Course.

A collection of similar types of entities put together is known as an entity set. An


entity set may contain entities with attribute sharing similar values. For example, a
Employee set may contain all the employees of a company. Entity sets need not be disjoint.

Fig. Representation of Entity.

Types of Entities
There are two types of entities. They are:

1. Strong Entity.
2. Weak Entity.

Strong Entity

Strong entity are those entity types which has a key attribute. The primary key helps

in identifying each entity uniquely. It is represented by a rectangle. In the below


example, roll_no identifies each row of the table uniquely and hence, we can say that

STUDENT is a strong entity.

Fig.Representation of Strong entity.

Weak Entity

Weak entity doesn't have a key attribute. Weak entity type can't be identified

on its own. Its existence depends upon some other strong entity. For example, there
can be children only if the parent exits. There can be no independent existence of

children.

A weak entity is represented by a double outlined rectangle. The relationship

between a weak entity type and strong entity type is called an identifying
B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


relationship and shown with a double outlined diamond. This representation can

be seen in the diagram below.

Example: If we have two entities of Loan (Loan_no, amount, Total_EMIs) and


Payment (Payment_Id, P_Amount, P_Date). In this case, we cannot identify the

Payment on its own, because there is no Loan.

Fig. Representation of Weak entity.

Attributes

An attribute is a property or characteristic of the entity that holds it. For example, a

Student might have attributes: roll_no, name, address, phone_no, etc. It is represented
by an ellipse/oval.

Fig. Representation of Attribute.

There exists a specific domain or set of values for each attribute from where the
attribute can take its values.
For example, a student's name cannot be a numeric value. It has to be alphabetic. A

student's age cannot be negative, etc.


Types of Attributes
In ER diagram, attributes associated with an entity set may be of the following types-

1. Simple attribute.
2. Composite attribute.
3. Single valued attribute.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


4. Multi valued attribute.

5. Derived attribute.
6. Key attribute.

1. Simple attribute

— Simple attributes are atomic values, which cannot be divided further.


Example:

Fig. Representation of Simple attributes

Here, student’s class, gender, dob are atomic values which cannot be divided further.

2. Composite attribute

— A composite attribute is made up of more than one simple attribute.


— A composite attribute can be further divisible.
Example:

Here, the attributes “Name” and “Address” are composite attributes as they are

composed of many other simple attributes.

Fig. Representation of Composite attributes

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


3. Single Valued Attribute:
— These are the attributes which can take only one value at a time.
Example:

Fig. Representation of Single valued attributes

Here, all the attributes are single valued attributes as they can take only one at a time.
4. Multi-Valued Attribute

— These are the attributes which can take more than one value at a time.
— They are represented by a double ellipse.
Example:

Fig. Representation of Multi-valued attributes

Here, the attributes “Mob_no” and “Email_id” are multi-valued attributes as they can

take more than one value.


5. Derived Attribute

— These are the attributes which can be derived from other attribute(s).
— They are represented by dashed ellipses.
Example:

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


Fig. Representation of Derived attributes

Here, “age” is a derived attribute as it can be derived from the attribute“dob”.

6. Key Attribute
— These are the attributes which can identify an entity uniquely in an entity set.
— Key attributes should be underlined.
Example:

Fig. Representation of Key attribute.


Here, the attribute “roll_no” is a key attribute as it can identify each student uniquely.

Relationship

A relationship is an association among two or more entities. Entities take part in the

relationship. It is represented by a diamond shape.

For example, an employee works at a specific department. Here, "works at"is a

relationship and this is the relationship between an Employee entity and a

Department entity.
Like entities, a relationship too can have attributes. These attributes are called

Descriptive attributes. Here “Since” is the descriptive attribute.

Fig. Example of Works_at relationship

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


Relationship Set

— A set of relationships of similar type is called a relationship set.

Degree of a Relationship

— The number of entity sets that participate in a relationship set is termed as the
Degree of that relationship. Degree of above relationship is 2.

Types of Relationships

On the basis of degree of a relationship set, a relationship can be classified into the
following types:
1. Unary relationship.

2. Binary relationship.
3. Ternary relationship.

4. N-ary relationship.
1. Unary relationship

— When there is a relationship between two entities of the same type is known
as Unary relationship. It is known as a recursive relationship.

— This means that the relationship is between different instances of the same
entity type.

— For example, an employee can supervise group of employees. Hence, this is a

recursive relationship of entity employee with itself.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


2. Binary Relationship
— When there are exactly two entity sets participating in a relationship then
such type of relationship is called binary relationship.

— For example, a student enrolls a course, Here, “enrolls” is a relationship and


this is the relationship between a Student entity and a Course entity.

3. Ternary relationship
— When there are exactly three entity sets participating in a relationship then
such type of relationship is called ternary relationship

— For example: In the real world, a patient goes to a doctor and doctor
prescribes the medicine to the patient, three entities Doctor, Patient and
Medicine are involved in the relationship “prescribes”.

N-ary relationship

— When more than three entity sets are participating in a relationship, then
such type of relationship is called an N-ary relationship

— For example: In the real world, a patient goes to a doctor and doctor
prescribes the diagnosis and medicine to the patient, four entities Doctor,
Patient, Medicine and Diagnostics are involved in the relationship
“prescribes”.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

Mapping Cardinalities/Constraints
— It defines how many entities in entity set A can be related to entities in
entity set B in a relationship set R.

(or)
— It defines number of instances participated in a relationship.
— It is most useful in describing the relationship sets that involve more than two
entity sets.

— For binary relationship set R on an entity set A and B, there are four possible.
— These are as follows:
1. One to one(1:1)
2. One to many(1:M)
3. Many to one(M:1)
4. Many to many(M:M)

1. 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 one entity in A.

— Symbol used:

For example, assume that the only male can be married to only one female and
one female can be married to only one male, this can be viewed as one- to-one
cardinality.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

2. One to Many(1:M)
— An entity in A is associated with any (zero or more) entities of B, and an
entity in B can be associated with at most one entity in A.

— Symbol used:

— For example, a customer can place multiple orders from a website/shop.

3. Many to One(M:1)

— An entity in A is associated with at most one entity in B and an entity in B


can be associated with any (zero or more) number of entities in A.

— Symbol used:

— For example: A student can belong to atmost one class but one class can have
many students.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


4. Many to Many(M :N)
— An entity in A is associated with any number of entities in B and an entity in
B is associated with any number of entities in A.
— Symbol used:

— For example: Here many books are written by many authors and many
authors write many books.

Participation Constraints

— There are two types of participation constraints—total and partial.


— The participation of an entity set E in a relationship set R is said to be total if
every entity in E participates in at least one relationship in R.

— If only some entities in E participate in relationships in R, the participation


of entity set E in relationship R is said to be partial.
— Double line indicates the total participation constraint.
— Single line indicates the partial participation constraint.
— For example, a student enrolled for course, if we are representing this as a
diagram,

— The participation of entity set course in enrolled relationship set is partial


Because a course may or may not have students enrolled in.

— The participation of entity set student in enrolled relationship set is total


Because every student is expected to relate atleast one course through the

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B


Enrolled relationship set

— Cardinality Constraints specify maximum participation i.e., Atmost.


— Participation Constraints specify minimum participation: At least or
Minimum.

Extended Features of E –R Model

As the complexity of data increased in the late 1980s, it became more and

more difficult to use the traditional ER Model for database modelling. Hence some

improvements or enhancements were made to the existing ER Model to make it able

to handle the complex applications better.

Hence, as part of the Enhanced ER Model, three new concepts were added to the

existing ER Model, they were:


1. Generalization.

2. Specialization.

3. Aggregation.

Features of Extended E-R Model

 EER creates a design more accurate to database schemas.


 It reflects the data properties and constraints more precisely.

 It includes all modeling concepts of the ER model.

 Diagrammatic technique helps for displaying the EER schema.


 It includes the concept of specialization and generalization.

Generalization

It is a bottom-up design approach in which two or more lower - level entities

are combined to form a higher-level entity if they have some common attributes.

Hence, lower-level entities are combined to form a more generalised entity.


For example, Teacher and Student entities can be generalized with entity name
Person based on some common attributes like Name, Address, Age and Aadhaar.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

Specialization

Specialization is opposite to Generalization. It is a top-down design approach in


which one higher level entity can be broken down into two or more lower - level
entities based on some distinct attributes.
For example, the generalized entity Account may be decomposed to further as
current account entity and savings account entity based on distinct attributes like
overdraft facility and minimum balance, interest rate respectively.

Aggregation

It is a process when relation between two entities is treated as a single entity. Simply
it is used when we need to express a relationship among other relationships.
(or)
Aggregation is an abstraction in which relationship sets (along with their associated
entity sets) are treated as higher-level entity sets, and can participate in relationships.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

In the diagram above, the relationship between College and Course together, is

acting as an Entity, which is in relationship with another entity Student. Now in real

world, if a Student visits College, he/she will never enquire about the College only
or just about the Course, rather he/she will enquire about both.

Weak entity set

 An entity set that does not have a primary key is referred to as a weak entity

set.
 The existence of a weak entity set depends on the existence of an identifying

entity set / strong entity set:


o It must relate to the identifying entity set via a total participation;
one- to-many relationship set from the identifying to the weak entity
set.

o Identifying relationship depicted using a double diamond.


 The discriminator (or partial key) of a weak entity set is the set of attributes

that distinguishes among all the entities of a weak entity set.


 The primary key of a weak entity set is formed by the primary key of the

strong entity set on which the weak entity set is existence dependent, plus the
weak entity set’s discriminator.
 We depict a weak entity set by double rectangles and underline the

Discriminator of a weak entity set with a dashed line.


 Weak entity relationship set depicted using double diamonds.
B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

Example: When the loan is approved, the customer begins payment. In this case,

the loan and payment are the two entities where the loan is a strong entity and

the payment is a weak entity, as its existence depends on the loan.


 Loan entity has loan_no as primary key.

 Payment entity has payment_no which is a discriminator.


 So, primary key for payment is (loan_no,payment_no).

Examples on Conceptual Design:

1. In a university, a student enrolls in Courses. A student must be assigned to at least

one or more Courses. Each course is taught by a single Professor. To maintain


instruction quality, a professor can deliver only one course. Construct an E-R diagram

for above problem.


Steps to Create an ER Diagram

1. Identify the Entities


2. Find relationships

3. Identify the cardinalities

4. Identify attributes including key attributes for every Entity

5. Draw complete E-R diagram with all attributes including Primary Key
Step1:Entity Identification.
1. Student.
2. Course.
3. Professor.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

Step2: Find Relationships.

1. Student enrolls a course.

2. Course taught by professor

Step3: Identify the cardinalities.


1. A student may enrolled for more than one course(one-to – many).

2. Each course is taught by one course(one–to -one)

Step4: Identify attributes including key attributes for every Entity.


Entity Attributes
Student roll_no,name,address
Course c_id,cname
Professor emp_id,ename,dept

Step5: Draw complete E-Rdiagram with all attributes including Primary key.

Fig. E-R Diagram

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

2. Construct an E-R Model for a college database:

Assumptions:

 A college contains many departments.


 Each department can offer any number of courses.

 Many faculties can work in a department.


 A faculty can work only in one department.

 For each department there is a Head.

 A faculty can be head of only one department.


 Each faculty can take any number of courses.

 A course can be taken by only one faculty.

 A studentcan enroll for any number of courses.

 Each course can have any number of students.

Step1:Identify the Entities.


1. Department.

2. Student.

3. Course.

4. Faculty.
Step2:Find the relationships:

 Student enrolls for course.

 Department offers courses.

 Department has multiple instructors


 Each department is supervisedby one faculty(Head).

 One course is taughtby only one instructor.


Step3:Identify the cardinalities

 One course is enrolled by multiple students and one student enrolls for

multiple courses, hence the cardinality between course and student is Many
to Many.
 The department offers many courses and each course belongs to only one

department, hence the cardinality between department and course is One to


Many.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

 One department has multiple instructors and one instructor belongs to one
and only one department, hence the cardinality between department and

instructor is One to Many.

 Each department there is a “Head of department” and one instructor is “Head

of department “, hence the cardinality is One to One.


 One course is taught by only one instructor, but the instructor teaches many

courses, hence the cardinality between course and instructor is Many to One.

Step4: Identify attributes including key attributes for every Entity.

 For the Department entity, the attributes are dept_id, dname, loc and here

dept_id is key attribute as it uniquely identifies every department.

 For the Course entity, the attributes are course-id, cname, duration, pre-

requisite and here course-idis key attribute.


 For the Faculty entity, the attributes are fac_id, fname, address, salary, and here

fac_id is key attribute.

 For the Student entity, the attributes are roll_no, sname, dob, address, mobile-

no and here roll_nois key attribute.

Step5:Draw complete E-R diagram with all attributes including Primary Key

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

3. Construct an E-R diagram for a Banking Management System.

Assumptions:

Where bank consists of many branches and every bank branch is situated in different
cities and can be uniquely identified by unique name. Each of these branches keeps

the tally of all the deposits and loans given to its customers. Bank customer have a

unique customer identifier, name, and postal address. A customer can have a
checking or a saving account and could also take loans. For loan customer may have

get services from personal bankers or loan officers. Each bank employee has a unique

identifier. Each employee has a manager, name, postal address, joining date, location

of branch. Accounts can be held by more than one customer and one customer can
have many accounts as well. Saving accounts has an interest rate where as Checking

account only keeps the record of deposits dates, amounts and check numbers.

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

DBMS UNIT -1 PART-B

***********EndofUNIT-II***********

B.ChandraSekhar@Dept. of IT,

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])


lOMoARcPSD|53142443

Downloaded by DEVARAJU PUTCHIGALLA ([email protected])

You might also like