0% found this document useful (0 votes)
43 views47 pages

DBMS Unit-I

The document discusses various applications of databases in sectors such as education, banking, railways, social media, and healthcare, highlighting their importance in managing large amounts of data efficiently. It also provides a historical perspective on the evolution of Database Management Systems (DBMS) from the 1960s to the present, detailing key developments and technologies. Additionally, it outlines the characteristics, advantages, and disadvantages of DBMS compared to traditional file systems.

Uploaded by

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

DBMS Unit-I

The document discusses various applications of databases in sectors such as education, banking, railways, social media, and healthcare, highlighting their importance in managing large amounts of data efficiently. It also provides a historical perspective on the evolution of Database Management Systems (DBMS) from the 1960s to the present, detailing key developments and technologies. Additionally, it outlines the characteristics, advantages, and disadvantages of DBMS compared to traditional file systems.

Uploaded by

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

UNIT-I

Database Applications
Nowadays, any business that has small or large amounts of data needs
a database to store and manage the information. The database is an
easy, reliable, secure, and efficient way to maintain business
information. There are many applications where databases are used.

1. Universities:
It is an undeniable application of the database. Universities have so
much data which can be stored in the database, such as student
information, teacher information, non-teaching staff information,

1
course information, section information, grade report information, and
many more. University information is kept safe and secure in the
database.

Anyone who needs information about the student, teacher, or course


can easily retrieve it from the database. Everything needs to be
maintained because even after ten years, information may be required,
and the information may be useful, so maintaining complete
information is the primary responsibility of any university or
educational institution.

2. Banking:
It is one of the major applications of databases. Banks have a huge
amount of data as millions of people have accounts that need to be
maintained properly. The database keeps the record of each user in a
systematic manner. Banking databases store a lot of information about
account holders. It stores customer details, asset details, banking
transactions, balance sheets, credit card and debit card details, loans,
fixed deposits, and much more. Everything is maintained with the
help of a database.

3. Railway Reservation System:


It is an inevitable area of application of databases. They store
information such as passenger name, mobile number, booking status,
reservation details, train schedule, employee information, account
details, seating arrangement, route & alternate route details, etc. All

2
the information needs to be maintained, so railways use a database
management system for their efficient storage and retrieval purpose.

4. Social Media Sites:


Nowadays, everyone has a smartphone and accounts on various social
media sites like Facebook, LinkedIn, Pinterest, Twitter, Instagram,
etc. People can chat with their friends and family and make new
friends from all over the world. Social media has millions of accounts,
which means they have a huge amount of data that needs to be stored
and maintained. Social media sites use databases to store information
about users, images, videos, chats, etc.

5. Library Management System:


There are hundreds and thousands of books in the library, so it is not
easy to maintain the records of the books in a register or diary, so a
database management system is used which maintains the information
of the library efficiently. The library database stores information like
book name, issue date, author name, book availability, book issuer
name, book return details, etc.

6. E-commerce Websites:
E-commerce websites are one of the prominent applications of the
database. Websites such as Flipkart, Myntra, Amazon, Nykaa,
Snapdeal, Shopify, and many more, are online shopping websites
where people buy items online. These websites have so much data.
These websites use databases to securely store and maintain customer
3
details, product details, dealer details, purchase details, bank & card
details, transactions details, invoice details, etc. You can analyze the
sales and maintain the inventory with the help of a database.

7. Medical:
There is a lot of important data collection in the medical field, so it is
necessary to use the database to store data related to the medical field,
such as patient details, medicine details, practitioner details, surgeon
details, appointment details, doctor schedule, patient discharge details,
payment detail, invoices, and other medical records. The database
management system is a boon for the medical field because it helps
doctors to monitor their patients and provide better care.

8. Accounting and Finance:


When there is big data regarding accounting and finance, there is a
need to maintain a large amount of data, which is done with the help
of a database. The database stores data such as accounting details,
bank details, purchases of stocks, invoice details, sales records, asset
details, etc. Accounting and finance database helps in maintaining and
analyzing historical data.

9. Industries:
The database management system is the main priority of industries
because they need to store huge amounts of data. The industry
database stores customer details, sales records, product lists,

4
transactions, etc. All the information is kept secure and maintained by
the database.

10. Airline Reservation System:


It is one of the applications of database management systems that
contain data such as passenger name, passenger check-in, passenger
departure, flight schedule, number of flights, distance from source to
destination, reservation information, pilot details, accounting detail,
route detail, etc. The database provides maintenance and security to
airline data.

11. Telecommunication:
We cannot deny that telecommunication has brought a remarkable
revolution worldwide. The Telecom field has huge data, and it is very
difficult to manage big data without a database; that is why a telecom
database is required, which stores data such as customer names,
phone numbers, calling details, prepaid & post-paid connection
records, network usage, bill details, balance details, etc.

12. Manufacturing:
In the manufacturing field, a lot of data needs to be maintained
regarding supply chain management, so the database maintains the
data such as product details, customer information, order details,
purchase details, payment info, worker's details, invoice, etc.
Manufacturing companies produce and supply products every day, so
it is important to use a database.
5
13. Human Resource Management:
Any organization will definitely have employees, and if there are a
large number of employees, then it becomes essential to store data in a
database as it maintains and securely saves the data, which can be
retrieved and accessed when required. The human resource database
stores data such as employee name, joining details, designation, salary
details, tax information, benefits & goodies details, etc.

14. Broadcasting:
Broadcasting is distributing video and audio content to a dispersed
audience by television, radio, or other means. Broadcasting database
stores data such as subscriber information, event recordings, event
schedules, etc., so it becomes important to store broadcasting data in
the database.

15. Insurance:
An insurance company needs a database to store large amounts of
data. Insurance database stores data such as policy details, user
details, buyer details, payment details, nominee details, address
details, etc.

6
A Historical Perspective
Database Management Systems (DBMS) have been around for
several decades, and their history can be traced back to the early
1960s. In the early days, computer systems were designed to manage
data in a hierarchical or navigational manner, where data was stored
in a tree-like structure. This method of storing data was inefficient and
difficult to use, as it required a lot of manual effort to access and
manage the data.

In the late 1960s, The first general-purpose DBMS, designed


by Charles Bachman, was called the Integrated Data Store
(IDS) which was based on network data model for which he was
received the Turing Award (The most prestigious award which is
equivalent to Nobel prize in the field of Computer Science.).

In the late 1970s, Mr Edgar Codd proposed a new data


representation framework called the Relational Database Model. Mr
Edgar Codd won the 1981 Turing Award for his seminal work. This
model was based on the concept of a table, with rows representing
individual records and columns representing individual fields within
those records. The relational model allowed for more efficient storage
and retrieval of data and was easier to use than the hierarchical or
navigational models.

In the late 1980s IBM developed the Structured Query Language


(SQL) for relational databases, as a part of R project. This system was
designed to manage large amounts of data and was used primarily in

7
corporate and government applications. SQL was adopted by the
American National Standards Institute (ANSI) and International
Organization for Standardization (ISO).

In the 1980s, several new DBMS products were introduced, including


Oracle, Sybase, and Microsoft SQL Server. These systems were
designed to be more user-friendly and to support more advanced data
modeling and query languages.

In the 1990s, object-oriented DBMS (OODBMS) emerged, which


were designed to store and manage complex data structures, such as
multimedia and other types of non-traditional data. These systems
were initially popular in research and academic environments, but
their adoption was limited in the commercial sector.

In the 1991, Microsoft ships MS access, a personal DBMS and that


displaces all other personal DBMS products.

In the 1997, XML applied to database processing. Many vendors


begin to integrate XML into DBMS products.

In the 2000s, web-based applications and cloud computing became


more popular, and DBMS systems began to adapt to these new
technologies. New DBMS systems were developed to support
distributed and web-based applications, including NoSQL databases
such as MongoDB and Cassandra.

Today, DBMS systems continue to evolve, with an emphasis on


scalability, performance, and support for cloud-based applications.

8
Some of the most popular DBMS systems in use today include
Oracle, Microsoft SQL Server, MySQL, PostgreSQL, and MongoDB.

What is Database
The database is a collection of inter-related data which is used to
retrieve, insert and delete the data efficiently. It is also used to
organize the data in the form of a table, schema, views, and reports,
etc.

For example: The college Database organizes the data about the
admin, staff, students and faculty etc.

Using the database, you can easily retrieve, insert, and delete the
information.

Database Management System


o Database management system is a software which is used to
manage the database. For example: MySQL, Oracle, etc are a
very popular commercial database which is used in different
applications.
o DBMS provides an interface to perform various operations like
database creation, storing data in it, updating data, creating a
table in the database and a lot more.
o It provides protection and security to the database. In the case of
multiple users, it also maintains data consistency.

9
DBMS allows users the following tasks:
o Data Definition: It is used for creation, modification, and
removal of definition that defines the organization of data in the
database.
o Data Updation: It is used for the insertion, modification, and
deletion of the actual data in the database.
o Data Retrieval: It is used to retrieve the data from the database
which can be used by applications for various purposes.
o User Administration: It is used for registering and monitoring
users, maintain data integrity, enforcing data security, dealing
with concurrency control, monitoring performance and
recovering information corrupted by unexpected failure.

Characteristics of DBMS
o It uses a digital repository established on a server to store and
manage the information.
o It can provide a clear and logical view of the process that
manipulates data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy
state in case of failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.

10
o It can view the database from different viewpoints according to
the requirements of the user.

Advantages of DBMS
o Controls database redundancy: It can control data redundancy
because it stores all the data in one single database file and that
recorded data is placed in the database.
o Data sharing: In DBMS, the authorized users of an
organization can share the data among multiple users.
o Easily Maintenance: It can be easily maintainable due to the
centralized nature of the database system.
o Reduce time: It reduces development time and maintenance
need.
o Backup: It provides backup and recovery subsystems which
create automatic backup of data
from hardware and software failures and restores the data if
required.
o multiple user interface: It provides different types of user
interfaces like graphical user interfaces, application program
interfaces

Disadvantages of DBMS
o Cost of Hardware and Software: It requires a high speed of
data processor and large memory size to run DBMS software.

11
o Size: It occupies a large space of disks and large memory to run
them efficiently.
o Complexity: Database system creates additional complexity and
requirements.
o Higher impact of failure: Failure is highly impacted the
database because in most of the organization, all the data stored
in a single database and if the database is damaged due to
electric failure or database corruption then the data may be lost
forever.

Difference Between File System and DBMS

o Basics o File System o DBMS

o The file system is


a way of arranging o DBMS is software
the files in a for managing the
storage medium database.
Structure within a computer.

o Redundant data
o In DBMS there is
o Data can be present in a
no redundant data.
Redundancy file system.

o Backup and o It doesn’t provide o It provides in house


Recovery Inbuilt mechanism tools for backup and

12
o Basics o File System o DBMS

for backup and


recovery of data
recovery of data if
even if it is lost.
it is lost.

o There is no
o Efficient query
efficient query
processing is there
o Query processing in the
in DBMS.
processing file system.

o There is more data


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

o It has more
o It is less complex complexity in
as compared to handling as
DBMS. compared to the file
o Complexity system.

o Security o File systems o DBMS has more


Constraints provide less security
security in mechanisms as
comparison to compared to file

13
o Basics o File System o DBMS

DBMS. systems.

o It has a
o It is less expensive comparatively
than DBMS. higher cost than a
o Cost file system.

o In DBMS data
independence exists,
mainly of two types:
o There is no data
o 1) Logical Data
independence.
o Data Independence .
Independenc o 2)Physical Data
e Independence.

o Only one user can o Multiple users can


access data at a access data at a
o User Access time. time.

o The users are not o The user has to


required to write write procedures for
o Meaning procedures. managing databases

o Sharing o Data is distributed o Due to centralized


in many files. So, nature data sharing

14
o Basics o File System o DBMS

it is not easy to
is easy
share data.

o It give details of
storage and o It hides the internal
o Data representation of details of Database
Abstraction data

o Integrity
o Integrity constraints
Constraints are
are easy to
o Integrity difficult to
implement
Constraints implement

o To access data in a
file , user requires
o No such attributes
attributes such as
are required.
file name, file
o Attribute s location.

o Example o Cobol , C++ o Oracle , SQL Server

Disadvantages of File system


 Each application has its data file so, the same data may have to
be recorded and stored many times.
15
 Data dependence in the file processing system are data-
dependent, but, the problem is incompatible with file format.

 Limited data sharing.

 The problem with security.

 Time-consuming.

 It allows you to maintain the record of the big firm having a


large number of items.

 Required lots of labor work to do.

Advantages of DBMS system


 DBMS offers a variety of techniques to store & retrieve data

 Uniform administration procedures for data

 Application programmers never exposed to details of data


representation and Storage.

 A DBMS uses various powerful functions to store and retrieve


data efficiently.

 Offers Data Integrity and Security.

 The DBMS implies integrity constraints to get a high level of


protection against prohibited access to data.

 Reduced Application Development Time

 Consume lesser space.

16
 Reduction of redundancy.

 Data independence.

Data Models:
1.Hierarchical Model

2. Network Model

3. Entity-Relationship Model

4. Object-Oriented Data Model

5. Relational Model

1.Hierarchical Model:This concept uses a hierarchical tree


structure to organise the data. The hierarchy begins at the root, which
contains root data, and then grows into a tree as child nodes are added
to the parent node.

Example

17
The following diagram depicts the relationship between the shoes
available on a shopping website:

2.Network Model
The main difference between this model and the hierarchical model is
that any record can have several parents in the network model. It uses
a graph instead of a hierarchical tree.

Example
We can observe that the node student has two parents, CSE
Department and Library, in the example below. In the hierarchical
model, this was previously impossible.

3.Entity-Relationship Model
18
The real-world problem is depicted in visual form in this model to
make it easier for stakeholders to comprehend. The ER diagram also
makes it very simple for developers to comprehend the system.

Example

The entities in the figure above are Teacher and Department.


Teacher_id, Teacher_Name, Age, Salary, and Mobile Number are the
characteristics of the Teacher object. Dept_name and Dept_id are the
attributes of the Department entity. The relationship is used to connect
the two entities, and each teacher is assigned to a department.

4.Object-Oriented Data Model:


Both the data and the relationship are contained in a single structure
that is known as an object in this model. We can now store audio,
video, pictures, and other types of data in databases, which was
previously impossible with the relational approach (Although you can
store video and audio in relational DB, it is advised not to store them
in the relational database).

19
Examples
Here is an example of this model:

Multiple objects are connected in this model using connections. The


following example can help you understand this.

20
The Employee and Department are the two objects in the example
above. Each object’s data and the relationships are there in a single
unit. Here, the attributes of the employee, such as Name and Job_title,
as well as the methods that will be performed by that object, are all
kept in a single object. The two objects are linked by a common
attribute, i.e., Department_id, as well as communication between
them will be accomplished by this common id.

5.Relational Model
The data in this model is kept in the form of a table that is two-
dimensional. All of the data is kept in the form of rows and columns.
Tables are the foundation of a relational paradigm.

A relational model represents how we can store data in Relational


Databases. Here, a relational database stores information in the form
of relations or tables.

Now, let us consider a relation EMPLOYEE with attributes ID_NO,


NAME, ADDRESS, ROLL_NO, and AGE shown in this table:

EMPLOYEE

21
ID_NO NAME ADDRESS ROLL_NO AGE

C1 RIYA DELHI 15 20

C2 SUNITA GURGAON 16 22

C3 ASHWANI ROHTAK 12 18

C4 PREETI DELHI 25

Levels of Abstraction in DBMS


 Data Abstraction is a process of hiding unwanted or irrelevant
details from the end user. It provides a different view and helps
in achieving data independence which is used to enhance the
security of data.

 The database systems consist of complicated data structures and


relations. For users to access the data easily, these complications
are kept hidden, and only the relevant part of the database is
made accessible to the users through data abstraction.

Levels of abstraction for DBMS


Database systems include complex data-structures. In terms of
retrieval of data, reduce complexity in terms of usability of users and
in order to make the system efficient, developers use levels of

22
abstraction that hide irrelevant details from the users. Levels of
abstraction simplify database design.

Mainly there are three levels of abstraction for DBMS

1. Physical or Internal Level

2. Logical or Conceptual Level

3. View or External Level

1. Physical or Internal Level


The internal level has an internal schema which describes the physical
storage structure of the database.

The internal schema is also known as a physical schema.

It uses the physical data model. 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.

23
Facts about Internal schema
The internal schema is the lowest level of data abstraction

It helps you to keeps information about the actual representation of


the entire database. Like the actual storage of the data on the disk in
the form of records

The internal view tells us what data is stored in the database and how

2. Logical or Conceptual Level


The conceptual schema describes the design of a database at the
conceptual level. Conceptual level is also known as logical level.

The conceptual schema describes the structure of the whole database.

The conceptual level describes what data are to be stored in the


database and also describes what relationship exists among those data.

In the conceptual level, internal details such as an implementation of


the data structure are hidden.

Programmers and database administrators work at this level.

Facts about Conceptual schema


 Defines all database entities, their attributes, and their
relationships
 Security and integrity information
 In the conceptual level, the data available to a user must be
contained in or derivable from the physical level.

24
3. View or External Level
It hides the unrelated details of the database from the user. There may
be “n” number of external views for each database.

Each external view is defined using an external schema, which


consists of definitions of various types of external record of that
specific view.

View level can be used by all users (all levels' users). This level is the
least complex and easy to understand.

Facts about External schema


 An external level is only related to the data which is viewed by
specific end users.
 This level includes some external schemas.
 External schema level is nearest to the user
 An external schema is also known as view schema.
 Each view schema describes the database part that a particular
user group is interested and hides the remaining database from
that user group.
 The view schema describes the end user interaction with
database systems.

Data Independence
o Data independence can be explained using the three-schema
architecture.

25
o Data independence refers characteristic of being able to modify
the schema at one level of the database system without altering
the schema at the next higher level.

There are two types of data independence:

1. Logical Data Independence


o Logical data independence refers characteristic of being able to
change the conceptual schema without having to change the
external schema.
o Logical data independence is used to separate the external level
from the conceptual view.
o If we do any changes in the conceptual view of the data, then the
user view of the data would not be affected.
o Logical data independence occurs at the user interface level.

2. Physical Data Independence


o Physical data independence can be defined as the capacity to
change the internal schema without having to change the
conceptual schema.
o If we do any changes in the storage size of the database system
server, then the Conceptual structure of the database will not be
affected.
o Physical data independence is used to separate conceptual levels
from the internal levels.

26
o Physical data independence occurs at the logical interface level.

Fig: Data Independence

Structure of DBMS

Database System Architecture


The typical structure of DBMS is based on Relational data model.
The top part of the architecture shows application interfaces used by
naive users, application programs created by application
programmers, query tools used by sophisticated users and
administration tools used by database administrator.
The lowest part of the architecture is for disk storage.
The Middle two parts(Query processor and storage manager) are
important components of database architecture.

27
Query Processor:
The interactive query processor helps the database system to simplify
and facilitate access to data. It consists of DDL(Data Definition
Language) interpreter, DML(Data Manipulation Language)
compiler and query evaluation engine.

The following are various functionalities and components of query


processor

 DDL interpreter: This is basically a translator which interprets


the DDL statements in data dictionaries.

28
 DML compiler: It translates DML statements query language
into an evaluation plan. This plan consists of the instructions
which query evaluation engine understands.

 Query evaluation engine: It executes the low-level instructions


generated by the DML compiler.

When a user issues a query, the parsed query is presented to a query


optimizer, which uses information about how the data is stored to
produce an efficient execution plan for evaluating the query. An
execution plan is a blueprint for evaluating a query. It is evaluated by
query evaluation engine.

Storage manager:
Storage manager is the component of database system that provides
interface between the low level data stored in the database and the
application programs and queries submitted to the system.

The storage manager is responsible for storing, retrieving, and


updating data in the database. The storage manager components
include

 Authorization and integrity manager: Validates the users who


want to access the data and tests for integrity constraints.

 Transaction manager: Ensures that the database remains in


consistent despite of system failures and concurrent transaction
execution proceeds without conflicting.

29
 File manager: Manages allocation of space on disk storage and
representation of the information on disk.

 Buffer manager: Manages the fetching of data from disk


storage into main memory. The buffer manager also decides
what data to cache in main memory. Buffer manager is a crucial
part of database system.

Storage manager implements several data structures such as

 Data files: Used for storing database itself.

 Data dictionary: Used for storing metadata, particularly schema


of database.

 Indices: Indices are used to provide fast access to data items


present in the database

ER Diagrams in DBMS
ER model in DBMS is the high-level data model. It stands for the
Entity-relationship model and is used to represent a logical view of
the system from a data perspective. In simple words, the entity
relationship diagram is a blueprint that can used to create a database.
E-R diagrams are used to model real-world objects like a person, a
car, a company and the relation between these real-world objects.

30
Features of ER model
 E-R diagrams are used to represent E-R model in a database,
which makes them easy to be converted into relations (tables).

 E-R diagrams provide the purpose of real-world modeling of


objects which makes them intently useful.

 E-R diagrams require no technical knowledge and no hardware


support.

 These diagrams are very easy to understand and easy to create


even by a naive user.

 It gives a standard solution of visualizing the data logically.

ER diagram basically having three components:

1. Entities − It is a real-world thing which can be a person, place,


or even a concept. For Example: Department, Admin, Courses,
Teachers, Students, Building, etc are some of the entities of a
School Management System.

2. Attributes − An entity which contains a real-world property


called an attribute. For Example: The entity employee has the
property like employee id, salary, age, etc.

3. Relationship − Relationship tells how two attributes are related.


For Example: Employee works for a department.

31
Component Symbol

Entity

Weak Entity

Attribute

Key Attribute

Composite
Attribute

Multivalued
Attribute

Derived
Attribute

Relationship

Weak
Relationship

Participation
Constraints

32
Attributes in DBMS
Attributes define the properties of a data object of entity. For example
if student is an entity, his ID, name, address, date of birth, class are its
attributes.

Types of Attributes in DBMS

1. Simple Attributes:
Simple attributes are attributes that are drawn from the atomic value
domains, which cannot be divided further.

2. Composite attribute:
Composite attributes are those attributes which are composed of many
other simple attributes. Composite attributes are made of more than
one simple attribute. For example, a student's complete name may
have first-name and last-name.

33
Simple Vs. Composite Attributes
Simple Attribute Composite Attribute

The attribute which cannot further The file system provides the
split into its components is a details of data representation and
simple attribute. storage of data.

Example: The marks of a student, Example: Name of the student can


the age of an employee etc. split into first, middle and last
name.

3. Single Valued Attributes:


Single valued attributes are those attributes which can take only one
value for a given entity from an entity set. Single-value attributes
contain single value. For example − age, gender etc.,.

34
4. Multi Valued Attributes:
Multi valued attributes are those attributes which can take more than
one value for a given entity from an entity set. Multi-value attributes
may contain more than one values. For example, a person know more
than one Languages, hobbies etc.

35
Single-Valued Vs. Multi-Valued Attributes
Single-Valued Attribute Multi-Valued Attribute

The attribute which has a single The attribute which takes up


value for each entity instance is more than one value for each
known as single-valued attribute. entity instance is known as
There is no alternative of this value. multi valued attribute.

Example: The RollNo, DOB, Gender Example: A person know more


of a student will always be a single than one Languages, and there
value. hobbies

5. Derived Attributes:
Derived attributes are those attributes which can be derived from
other attribute(s).

Derived attributes are the attributes that do not exist in the physical
database, but their values are derived from other attributes present in
the database. For example, age of the student should not be saved
directly in the database, instead it can be derived from Date of Birth.

36
Stored Vs. Derived Attributes
Stored Attribute Derived Attributes

An attribute which cannot An attribute which is determine the


derive from other attributes value from other attributes is a
and it is mandatory to be derived attribute and it is not
stored in the database. mandatory to be stored in the
database.

Example: The value which is Example: Age of student can be


fixed like Date of Birth. derived from DOB.

6. Key Attributes:
Key attributes are those attributes which can identify an entity
uniquely in an entity set.

37
Key is an attribute or collection of attributes that uniquely identifies
an entity among entity set. For example, the roll_number of a student
makes him/her identifiable among students.

Student Entity with all types of Attributes

Entity in DBMS
Entity: An entity is anything in the real world, such as an object,
class, person, or place. Objects that physically exist and are logically
constructed in the real world are called entities. An entity is
distinguishable from other entity.

38
Entity type: The entity type is a collection of the entity having
similar attributes.

Entity set: is a group of entities of similar kinds. It can contain


entities with attributes that share similar values. It's collectively a
group of entities of a similar type. The entity set need not be disjoint.

In summary, an Entity is an object of a Type Entity and the set of all


entities is called an entity set.

Entities are of two types:


Strong Entity – A strong entity is an entity type that has a key
attribute. It doesn't depend on other entities in the schema. A strong
entity always has a primary key, and it is represented by a single
rectangle in the ER diagram.

Weak Entity – Weak entity type doesn’t have a key attribute and so
we cannot uniquely identify them by their attributes alone. Therefore,
a foreign key must be used in combination with its attributes to create
a primary key. They are called Weak entity types because they can’t
be identified on their own. It relies on another powerful entity for its
unique identity. A weak entity is represented by a double-outlined
rectangle in ER diagrams.
39
Strong Entity v/s Weak Entity
Strong Entity Weak Entity

Strong entity always has a While a weak entity has a partial


primary key. discriminator key.

Strong entity is not dependent Weak entity depends on strong entity.


on any other entity.

Strong entity is represented Weak entity is represented by a double


by a single rectangle. rectangle.

Two strong entity’s While the relation between one strong


relationship is represented by and one weak entity is represented by a
a single diamond. double diamond.

Strong entities have either While weak entity always has total
total participation or not. participation.

Relationships in DBMS
A relationship is defined as an association among several entities.

40
Relationship Set
A set of relationships of similar type is called a relationship set. Like
entities, a relationship too can have attributes. These attributes are
called descriptive attributes.

Mapping Cardinalities:
express the number of entities to which another entity can be
associated via a relationship. For binary relationship sets between
entity sets A and B, the mapping cardinality must be one of:

One-to-one: 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.

One-to-many: An entity in A is associated with any number in B.


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 any number in A.
41
Many-to-many: Entities in A and B are associated with any
number from each other.

The appropriate mapping cardinality for a particular relationship set


depends on the real world being modeled.

Degree of a Relationship Set


The number of entity sets that participate in a relationship set is
termed as the degree of that relationship set. Thus,

Degree
Degree of a relationship set = Number of entity sets participating in a
relationship set

Types of Relationship Sets

42
On the basis of degree of a relationship set, a relationship set can be
classified into the following types-

Unary relationship set

Binary relationship set

Ternary relationship set

Unary Relationship Set


Unary relationship set is a relationship set where only one entity set
participates in a relationship set.

Binary Relationship Set


Binary relationship set is a relationship set where two entity sets
participate in a relationship set.

Ternary Relationship Set


43
Ternary relationship set is a relationship set where three entity sets
participate in a relationship set.

Participation Constraints

Total Participation of an Entity set


Total participation of an entity set represents that each entity in entity
set must have at least one relationship in a relationship set. It is also
called mandatory participation. Total participation is represented
using a double line between the entity set and relationship set.

Partial participation of an Entity Set


Partial participation of an entity set represents that each entity in the
entity set may or may not participate in the relationship instance in
that relationship set. It is also called as optional participation. Partial
participation is represented using a single line between the entity set
and relationship set.

44
Additional Features of the ER Model in DBMS
As the complexity of data increased, it became more and more
difficult to use the traditional ER Model for database modelling.
Hence some Additional Features were made to the existing ER Model
to make it able to handle the complex applications better.

Hence, Three new concepts were added to the existing ER Model,


they were:

Generalization

Specialization

Aggregration

Some entities have relationships that form hierarchies. For instance,


Employee can be an hourly employee or contracted employee.

In this relationship hierarchies, some entities can act as superclass and


some other entities can act as subclass.

Superclass: An entity type that represents a general concept at a high


level, is called superclass.

Subclass: An entity type that represents a specific concept at lower


levels, is called subclass.

45
The subclass is said to inherit from superclass. When a subclass
inherits from one or more super classes, it inherits all their attributes.
In addition to the inherited attributes, a subclass can also define its
own specific attributes.

The symbol used for specialization/ Generalization is

Generalization
Generalization is a process of extracting common properties from a
set of entities and creating a generalized entity from it. It is a bottom-
up approach, and it helps to reduce the size and complexity of the
schema.

Example: Let us take two low-level entities as Car and Bus, and these
two will have many common attributes and some specific attributes.
And We will generalize and link the common attributes to the newly
formed high-level entity named Vehicle.

Specialization
Specialization is opposite to Generalization. In this, entity is divided
into sub-entities bases on their characteristic’s(distinguishing
features). It breaks an entity into multiple entities from higher level to
lower level. It is a top down approach.

46
Aggregation
Aggregation refers to the process by which entities are combined to
form a single meaningful entity. The specific entities are combined
because they do not make sense on their own. To establish a single
entity, aggregation creates a relationship that combines these entities.
The resulting entity makes sense because it enables the system to
function well.

47

You might also like