0% found this document useful (0 votes)
16 views92 pages

DBMS Module 1

Uploaded by

luvgoswami39
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)
16 views92 pages

DBMS Module 1

Uploaded by

luvgoswami39
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/ 92

DATABASE MANAGEMENT

SYSTEMS
CSE304

COURSE INTRODUCTION
Semester: III, Session :Jul-Dec 2025

Faculty:
Dr. Vikrant Chole
Department of Computer Science and Engineering
Amity School of Engineering and Technology
Amity University Madhya Pradesh
University: Vision and Mission

Vision of the University


To make Amity University Madhya Pradesh a Centre of
Excellence in Higher Education by providing value based
holistic education, inculcating leadership qualities, encouraging
research, innovation and nurturing talent.

Mission of the University


To provide quality education catering for diverse, contemporary
educational and research needs of the nation with emphasis on
regional aspirations and develop balanced personalities with
positive outlook and leadership qualities.

2
Mission and Vision of the Department
Vision of the Department
To empower the next generation of computer
professionals with the skills and knowledge to drive
technological progress and societal development through
excellence in education, research, and innovation.

Mission of the Department


1. To integrate excellence in education, research, and practical innovation to
address complex challenges in the tech industry.
2. To create a dynamic learning environment that merges education, cutting-edge
research, and innovation to contribute to societal advancement.
3. To prepare students to lead technological advancements with ethical decision-
making and innovative thinking.
4. To develop highly skilled computer professionals to contribute to both global
and regional technological advancements.
Outcome based education (OBE)
Outcome-Based Education (OBE) is a student-centric teaching and learning methodology in which the course
delivery, assessment are planned to achieve stated objectives and outcomes. It focuses on measuring student
performance i.e. outcomes at different levels.

Some important aspects of the OBE


1. Bloom’s Taxonomy
2. Course Outcome (CO)
3. Programme Outcomes (POs)
4. Program Educational Objectives (PEOs)
5. Programme Specific Outcomes (PSO)

4
Bloom’s Taxonomy

Department of CSE 5
Program Outcomes for Engineering
PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and an engineering specialization to the
1
solution of complex engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex engineering problems reaching substantiated conclusions
2
using first principles of mathematics, natural sciences, and engineering sciences.

PO3: Design/development of solutions: Design solutions for complex engineering problems and design system components or processes that meet the
3
specified needs with appropriate consideration for the public health and safety, and the cultural, societal, and environmental considerations.

PO4: Conduct investigations of complex problems: Use research-based knowledge and research methods including design of experiments, analysis
4
and interpretation of data, and synthesis of the information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools including prediction and
5
modeling to complex engineering activities with an understanding of the limitations.
PO6: The Engineer and the World: Assess societal, environmental, economic, health, safety, legal, cultural aspects of engineering solutions and their
6
impacts on sustainability.
7 PO7: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the engineering practice.

8 PO8: Individual and team work: Function effectively as an individual, and as a member or leader in diverse teams, and in multidisciplinary settings.

PO9: Communication: Communicate effectively on complex engineering activities with the engineering community and with society at large, such as,
9 being able to comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
PO10: Project management and finance: Demonstrate knowledge and understanding of the engineering and management principles and apply these to
10
one’s own work, as a member and leader in a team, to manage projects and in multidisciplinary environments.
PO11: Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent and life-long learning in the broadest
11
context of technological change.
The Program Specific Outcomes (PSOs) of UG Program in Computer Science & Engineering

S.No PROGRAM SPECIFIC OUTCOMES (PSO)


PSO1:Computer Science and Engineering graduates will be equipped to
1 engage with next-generation computing technologies aligned with the
evolving demands of Industries.
PSO2:Computer Science and Engineering students will apply practical
2 engineering skills gained through internships and research projects to
address real-world challenges across diverse domains.

PSO3:Computer Science and Engineering graduates will demonstrate career


3 readiness and innovative thinking to excel in training, entrepreneurship, and
start-up initiatives.

AUMP 7
The Program Educational Objectives (PEOs) of UG Program in Computer Science &
Engineering

PROGRAM EDUCATIONAL OBJECTIVES(PEOs)


PEO-1: To establish a successful career in the field of Computer
1 Science, contributing effectively to the development and application of
technology.

2
PEO-2: To engage in advanced studies and research, continuously
advancing knowledge in the dynamic field of Computer Science.
PEO-3: To demonstrate professionalism, collaborative skills, and a
strong sense of social responsibility in both personal and professional
3
endeavors.
Course Description

School: ASET Batch :2024-2028


Program: B.Tech Current Academic Year: 2025-26
Branch: ALL Semester: III
1 Course Code CSE304
2 Course Title DATABASE MANAGEMENT SYSTEMS
3 Credits 3
4 Contact Hours (L-T-P) 3-0-0

5 Course Status Basic


6 Course Objective The objective of this course is to get students familiar with
Databases and their use. They can identify different types of
available database model, concurrency techniques and new
applications of the DBMS.
9
Mode of Examination(Assessment)
About Faculty:
Dr. Vikrant Chole is a Associate Professor in the Department of
Computer Science and Engineering at the Amity School of
Engineering and Technology, Amity University Gwalior. With over
16 years of teaching experience in reputed institutions across
India, he has established himself as a dedicated academician.
He has authored and co-authored numerous research papers
published in reputed journals and presented at international
conferences. His contributions extend beyond teaching and
research, as he has been invited to deliver expert lectures, keynote
talks, and has also served as a session chair at various academic
forums both within and outside the university.
Qualification Ph.D, M.Tech, B.E
Email Id: [email protected]
Mobile: +91-9423118113

Room: 101 Block-E


Amity School of Engineering & Technology

Course Outcomes:
The student will be able to

• Describe DBMS architecture, physical and logical database designs, database modeling, relational,
hierarchical and network models.

• Identify basic database storage structures and access techniques such as file organizations, indexing
methods including B‐tree, and hashing.

• Learn and apply Structured query language (SQL) for database definition and database manipulation.

• Demonstrate an understanding of normalization theory and apply such knowledge to the normalization
of a database.

• Understand various transaction processing, concurrency control mechanisms and database protection
mechanisms.
Amity School of Engineering & Technology

Syllabus
Course Code: CSE 304 Credit Units: 03
Total Hours: 45
Course Contents:
Module I: Introduction: (9 Hours)
Concept and goals of DBMS, Database Languages, Database Users, Database Abstraction.
Basic Concepts of ER Model, Relationship sets, Keys, Mapping, Design of ER Model ,Concept of Generalization, Aggregation and Specialization. transforming
ER diagram into the tables. Various other data models object oriented data Model, Network data model, and Relational data model.
Module II: Relational Data models: (9 Hours)
Domains, Tuples, Attributes, Relations, Characteristics of relations, Keys, Key attributes of relation, Relational database, Schemas, Integrity constraints.
Referential integrity, Intension and Extension, Relational Query languages: SQL-DDL, DML, integrity constraints, Complex queries, various joins, indexing,
triggers ,Relational algebra and relational calculus, Relational algebra operations like select, Project, Join, Division, outer union. Tuple relational calculus.
Module III: Data Base Design: (9 Hours)
Data Base Design: Introduction to normalization, Normal forms, Functional dependency, Decomposition, Dependency preservation and lossless join,
problems with null valued and dangling tuples, multivalued dependencies.
Module IV: Transaction Processing Concepts: (9 Hours)
Transaction System, Testing of Serilizability, Serializability of schedules, conflict & view serializable schedule, recoverability, Recovery from transaction
failures. Log based recovery. Checkpoints deadlock handling. Concurrency Control Techniques: – Concurrency Control, locking Techniques for concurrency
control, time stamping protocols for concurrency control, validation-based protocol, multiple granularity. Multi version schemes, Recovery with concurrent
transaction.
Module V: Relational Database Management Systems: (9 Hours)
Study of Relational Database Management Systems through Oracle/Postgres SQL/MySQL: Architecture, physical files, memory structures, background
process. Concept of table spaces, segments, extents and block. Dedicated server, multi-threaded server, distributed database. Introduction of ANSI SQL.
Usage of like, any, all, exists, views and other commands, Special operators. Hierarchical queries, inline queries, flashback queries
Amity School of Engineering & Technology

Text & References:

Text:
•Korth, Silberschatz, “Database System Concepts”, 4th Ed., TMH, 2000.
•Steve Bobrowski, “Oracle & Architecture”, TMH, 2000

References:
•Date C. J., “An Introduction to Database Systems”, 7th Ed., Narosa Publishing, 2004
•Elmsari and Navathe, “Fundamentals of Database Systems”, 4th Ed., A. Wesley, 2004
•Ullman J. D., “Principles of Database Systems”, 2nd Ed., Galgotia Publications, 1999.
Amity School of Engineering & Technology

MODULE - I
Amity School of Engineering & Technology

What is Data?

 A single piece of data is a single fact about something that interests us.

 A fact can be any characteristic of an object.


Amity School of Engineering & Technology

How do we store Data into Computers?.


• Data could be stored computers in File System or
Database System
• Let us focus on File System and Database approaches .
Each one has its own advantages and disadvantages.
Amity School of Engineering & Technology

File System Vs Database System


File System Database System
Amity School of Engineering & Technology

File System Vs Database System Cont…


File System Database System
Amity School of Engineering & Technology

File System Issues


• Redundancy of data: Data is said to be redundant if same data is copied at many places. If a student
wants to change Phone number, he has to get it updated at various sections. Similarly, old records
must be deleted from all sections representing that student.
• Inconsistency of Data: Data is said to be inconsistent if multiple copies of same data does not match
with each other. If Phone number is different in Accounts Section and Academics Section, it will be
inconsistent. Inconsistency may be because of typing errors or not updating all copies of same data.
• Difficult Data Access: A user should know the exact location of file to access data, so the process is
very cumbersome and tedious. If user wants to search student hostel allotment number of a student
from 10000 unsorted students’ records, how difficult it can be.
• Unauthorized Access: File System may lead to unauthorized access to data. If a student gets access
to file having his marks, he can change it in unauthorized way.
• No Concurrent Access: The access of same data by multiple users at same time is known as
concurrency. File system does not allow concurrency as data can be accessed by only one user at a
time.
• No Backup and Recovery: File system does not incorporate any backup and recovery of data if a file
is lost or corrupted.


Amity School of Engineering & Technology

What is Database?
• Database: Database is a collection of inter-related data which helps in efficient
retrieval, insertion and deletion of data from database and organizes the data in the
form of tables, views, schemas, reports etc.
For Example, university database organizes the data about students, faculty, and
admin staff etc. which helps in efficient retrieval, insertion and deletion of data from
it.
• Now Database Management talks about
– Create Database
– Retrieve(View) database
– Update database
– Delete Database
Amity School of Engineering & Technology

Example of a simple database


Amity School of Engineering & Technology

What is DBMS?
• Database Management System: The software which is used to manage database
is called Database Management System (DBMS). For Example, MySQL, Oracle etc.
are popular commercial DBMS used in different applications.
DBMS allows users the following tasks:
• Data Definition: It helps in creation, modification and removal of definitions that
define the organization of data in database.
• Data Updation: It helps in insertion, modification and deletion of the actual data in
the database.
• Data Retrieval: It helps in retrieval of data from the database which can be used by
applications for various purposes.
• User Administration: It helps in registering and monitoring users, enforcing data
security, monitoring performance, maintaining data integrity, dealing with
concurrency control and recovering information corrupted by unexpected failure.
Amity School of Engineering & Technology

Database Management System (DBMS)


• DBMS contains information about a particular enterprise
– Collection of interrelated data
– Set of programs to access the data
– An environment that is both convenient and efficient to use
• Database Applications:
– Banking: transactions
– Airlines: reservations, schedules
– Universities: registration, grades
– Sales: customers, products, purchases
– Online retailers: order tracking, customized recommendations
– Manufacturing: production, inventory, orders, supply chain
– Human resources: employee records, salaries, tax deductions
• Databases can be very large.
• Databases touch all aspects of our lives
Amity School of Engineering & Technology

Advantages of DBMS
1. 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.
2. Data sharing: In DBMS, the authorized users of an organization can share the data among multiple users.
3. Easily Maintenance: It can be easily maintainable due to the centralized nature of the database system.
4. Reduce time: It reduces development time and maintenance need.
5. Backup: It provides backup and recovery subsystems which create automatic backup of data
from hardware and software failures and restores the data if required.
6. multiple user interface: It provides different types of user interfaces like graphical user interfaces, application
program interfaces
Disadvantages of DBMS
1. Cost of Hardware and Software: It requires a high speed of data processor and large memory size to run DBMS
software.
2. Size: It occupies a large space of disks and large memory to run them efficiently.
3. Complexity: Database system creates additional complexity and requirements.
4. 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.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Data Models
• A collection of tools for describing
– Data
– Data relationships
– Data semantics
– Data constraints
• Relational model
• Entity-Relationship data model (mainly for database design)
• Object-based data models (Object-oriented and Object-relational)
• Semistructured data model (XML)
• Other older models:
– Network model
– Hierarchical model
Amity School of Engineering & Technology

Database Languages in DBMS


• A DBMS has appropriate languages and interfaces to express database queries and updates.
• Database languages can be used to read, store and update the data in the database.
Types of Database Languages
1. Data Definition Language (DDL)
• DDL stands for Data Definition Language. It is used to define database structure or pattern.
• It is used to create schema, tables, indexes, constraints, etc. in the database.
• Using the DDL statements, you can create the skeleton of the database.
• Data definition language is used to store the information of metadata like the number of tables and schemas, their
names, indexes, columns in each table, constraints, etc.
Here are some tasks that come under DDL:
• Create: It is used to create objects in the database.
• Alter: It is used to alter the structure of the database.
• Drop: It is used to delete objects from the database.
• Truncate: It is used to remove all records from a table.
• Rename: It is used to rename an object.
• Comment: It is used to comment on the data dictionary.
• These commands are used to update the database schema that's why they come under Data definition language.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Database Languages in DBMS


2. Data Manipulation Language (DML)
• DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a
database. It handles user requests.
Here are some tasks that come under DML:
• Select: It is used to retrieve data from a database.
• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
• Merge: It performs UPSERT operation, i.e., insert or update operations.
• Call: It is used to call a structured query language or a Java subprogram.
• Explain Plan: It has the parameter of explaining data.
• Lock Table: It controls concurrency.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Database Languages in DBMS


3. Data Control Language (DCL)
• DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
• The DCL execution is transactional. It also has rollback parameters.
(But in Oracle database, the execution of data control language does not have the feature of rolling back.)
Here are some tasks that come under DCL:
• Grant: It is used to give user access privileges to a database.
• Revoke: It is used to take back permissions from the user.
• There are the following operations which have the authorization of Revoke:
• CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.
4. Transaction Control Language (TCL)
• TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical
transaction.
Here are some tasks that come under TCL:
• Commit: It is used to save the transaction on the database.
• Rollback: It is used to restore the database to original since the last Commit.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Database Users
Users are differentiated by the way they expect to interact with
the system.
• Application programmers: interact with system through DML
calls.
• Specialized users: write specialized database applications that
do not fit into the traditional data processing framework
• Sophisticated users: form requests in a database query
language.
• Naive users: invoke one of the permanent application programs
that have been written previously
Amity School of Engineering & Technology

Database Administrator(DBA)
• Coordinates all the activities of the database system; the database administrator has a
good understanding of the enterprise’s information resources and needs:
• Database administrator’s duties include:
– Schema definition
– Storage structure and access method definition
– Schema and physical organization modification
– Granting user authority to access the database
– Specifying integrity constraints
– Monitoring performance and responding to changes in requirements
Amity School of Engineering & Technology

Database Users

Database
Amity School of Engineering & Technology
Database System Components
Amity School of Engineering & Technology

Database Architecture types


The architecture of a database systems is greatly influenced by
the underlying computer system on which the database is running:
• Centralized
• Client-server
• Parallel (multi-processor)
• Distributed
Amity School of Engineering & Technology
DBMS Architecture types
Database architecture can be seen as a single tier or multi-tier. But logically, database architecture is of
two types like: 2-tier architecture and 3-tier architecture.
1-Tier Architecture
• In this architecture, the database is directly available to the user. It means the user can directly sit on
the DBMS and uses it.
• Any changes done here will directly be done on the database itself. It doesn't provide a handy tool for
end users.
• The 1-Tier architecture is used for development of the local application, where programmers can
directly communicate with the database for the quick response.
2-Tier Architecture
• The 2-Tier architecture is same as basic client-server. In the two-tier architecture, applications on the
client end can directly communicate with the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
• The user interfaces and application programs are run on the client-side.
• The server side is responsible to provide the functionalities like: query processing and transaction
management.
• To communicate with the DBMS, client-side application establishes a connection with the server side.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

3-Tier Architecture
• The 3-Tier architecture contains another layer between the
client and server. In this architecture, client can't directly
communicate with the server.
• The application on the client-end interacts with an application
server which further communicates with the database system.
• End user has no idea about the existence of the database
beyond the application server. The database also has no idea
about any other user beyond the application.
• The 3-Tier architecture is used in case of large web
application.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology
Three schema Architecture
• The three schema architecture is also called ANSI/SPARC architecture or three-level architecture.
• This framework is used to describe the structure of a specific database system.
• The three schema architecture is also used to separate the user applications and physical database.
• The three schema architecture contains three-levels. It breaks the database down into three different categories.
The three-schema architecture is as follows:

In the above diagram:


• It shows the DBMS architecture.
• Mapping is used to transform the request and
response between various database levels of
architecture.
• Mapping is not good for small DBMS because it takes
more time.
• In External / Conceptual mapping, it is necessary to
transform the request from external level to
conceptual schema.
• In Conceptual / Internal mapping, DBMS transform
the request from the conceptual to internal level.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Levels of Abstraction
• Physical level: describes how a record (e.g., instructor) is stored.
• Logical level: describes data stored in database, and the relationships
among the data.
type instructor = record
ID : string;
name : string;
dept_name : string;
salary : integer;
end;
• View level: application programs hide details of data types. Views can also
hide information (such as an employee’s salary) for security purposes.
Amity School of Engineering & Technology

View of Data
An architecture for a database system
Amity School of Engineering & Technology

Database Abstraction:
• Data abstraction is the process of hiding unwanted and irrelevant details from the end user. It helps to
store information in such a way that the end user can access data which is necessary, the user will not be
able to see what data is stored or how it is stored in a database. Data abstraction helps to keep data
secure from unauthorized access and it hides all the implementation details.
• Levels of Abstraction in DBMS
• There are three levels of data abstraction in DBMS that are mentioned below.

1. Physical or internal level


2. logical or conceptual level
3. view or external level
Amity School of Engineering & Technology

Database Abstraction:
1. Physical or Internal Level
• It is the lowest level of data abstraction which defines how data is stored in database . It defines
data structures used to store data and methods to access data in database. It is very complex to
understand and hence kept hidden from user. Database administrator decides how and where
to store the data in database.
• Physical level deals with actual storage details like data organization, disk space allocation and
data access methods.
2. Logical or Conceptual Level
• It is intermediate level present next to physical level. It defines what data is present in database
and their relationships between them . It is less complex as compared to physical level.
Programmers generally work at this level and depending on data, structure of tables,
relationships and their constraints is decided at this level.
3. View or External Level
• It is the highest level in abstraction. There are different levels of views and each view defines
only a part of whole data required to user. This level defines many views of same database for
simplication of view to user. This is the highest level and easiest to understand for user.
Amity School of Engineering & Technology

Instances and Schemas


Similar to types and variables in programming languages
•Logical Schema – the overall logical structure of the database
–Example: The database consists of information about a set of customers and
accounts in a bank and the relationship between them
4Analogous to type information of a variable in a program
•Physical schema– the overall physical structure of the database
•Instance – the actual content of the database at a particular point in time
–Analogous to the value of a variable
•Physical Data Independence – the ability to modify the physical schema
without changing the logical schema
–Applications depend on the logical schema
–In general, the interfaces between the various levels and components should be
well defined so that changes in some parts do not seriously influence others.
Amity School of Engineering & Technology

Basic Concepts of ER Model,


• Peter Chen developed the ER diagram in 1976. The ER model was created to provide a simple
and understandable model for representing the structure and logic of databases.
• ER model stands for an Entity-Relationship model. It is a high-level data model. This model is used
to define the data elements and relationship for a specified system.
• It develops a conceptual design for the database. It also develops a very simple and easy to design
view of data.
• In ER modeling, the database structure is portrayed as a diagram called an entity-relationship
diagram.
Why Use ER Diagrams In DBMS?
• ER diagrams represent the E-R model in a database, making them easy to convert into relations
(tables).
• ER diagrams provide the purpose of real-world modeling of objects which makes them intently
useful.
• ER diagrams require no technical knowledge and no hardware support.
• These diagrams are very easy to understand and easy to create even for a naive user.
• It gives a standard solution for visualizing the data logically.
Amity School of Engineering & Technology

Basic concepts of ER model


• The ER data model was developed to facilitate database design by allowing
specification of an enterprise schema that represents the overall logical structure of a
database.
• The ER model is very useful in mapping the meanings and interactions of real-world
enterprises onto a conceptual schema. Because of this usefulness, many database-
design tools draw on concepts from the ER model.
• The ER data model employs three basic concepts:
– entity sets,
– relationship sets,
– attributes.
• The ER model also has an associated diagrammatic representation, the ER diagram,
which can express the overall logical structure of a database graphically.
Amity School of Engineering & Technology

Entity Sets
• An entity is an object that exists and is distinguishable from other objects.
– Example: specific person, company, event, plant
• An entity set is a set of entities of the same type that share the same properties.
– Example: set of all persons, companies, trees, holidays
• An entity is represented by a set of attributes; i.e., descriptive properties possessed
by all members of an entity set.
– Example:
instructor = (ID, name, street, city, salary )
course= (course_id, title, credits)
• A subset of the attributes form a primary key of the entity set; i.e., uniquely
identifiying each member of the set.
Amity School of Engineering & Technology

Entity Sets -- instructor and student


instructor_ID instructor_name student-ID student_name
Amity School of Engineering & Technology

Relationship Sets
• A relationship is an association among several entities
Example:
44553 (Peltier) advisor 22222 (Einstein)
student entity relationship set instructor entity
• A relationship set is a mathematical relation among n  2 entities, each taken from entity
sets
{(e1, e2, … en) | e1  E1, e2  E2, …, en  En}

where (e1, e2, …, en) is a relationship


– Example:
(44553,22222)  advisor
Amity School of Engineering & Technology

Relationship Set advisor


Amity School of Engineering & Technology

Relationship Sets (Cont.)


• An attribute can also be associated with a relationship set.
• For instance, the advisor relationship set between entity sets instructor and
student may have the attribute date which tracks when the student started being
associated with the advisor
Amity School of Engineering & Technology

Degree of a Relationship Set


• binary relationship
– involve two entity sets (or degree two).
– most relationship sets in a database system are binary.
• Relationships between more than two entity sets are rare. Most
relationships are binary. (More on this later.)
4Example: students work on research projects under the
guidance of an instructor.
4relationship proj_guide is a ternary relationship between
instructor, student, and project
Amity School of Engineering & Technology

Complex Attributes
• Attribute types:
– Simple and composite attributes.
– Single-valued and multivalued attributes
• Example: multivalued attribute: phone_numbers
– Derived attributes
• Can be computed from other attributes
• Example: age, given date_of_birth
• Domain – the set of permitted values for each attribute
Amity School of Engineering & Technology

Composite Attributes
Amity School of Engineering & Technology

Mapping Cardinality Constraints

• Express the number of entities to which another entity can be


associated via a relationship set.
• Most useful in describing binary relationship sets.
• For a binary relationship set the mapping cardinality must be one of
the following types:
– One to one
– One to many
– Many to one
– Many to many
Amity School of Engineering & Technology

Mapping Cardinalities

One to one One to many

Note: Some elements in A and B may not be mapped to any


elements in the other set
Amity School of Engineering & Technology

Mapping Cardinalities

Many to one Many to many


Note: Some elements in A and B may not be mapped to any
elements in the other set
Amity School of Engineering & Technology

E-R Diagrams
Entity-Relationship Diagrams (E-R diagrams) can express the overall
logical structure of a database graphically
An E-R diagram consists of the following major components:

• Rectangles divided into two parts represent entity sets. The first part, which
is shaded blue, contains the name of the entity set. The second
part contains the names of all the attributes of the entity set.
• Diamonds represent relationship sets.
• Undivided rectangles represent the attributes of a relationship set. Attributes
that are part of the primary key are underlined.
• Lines link entity sets to relationship sets.
• Dashed lines link attributes of a relationship set to the relationship set.
• Double lines indicate total participation of an entity in a relationship set.
• Double diamonds represent identifying relationship sets linked to weak
entity sets (we discuss identifying relationship sets and weak entity sets later)
Amity School of Engineering & Technology

Entity Sets
n Entities can be represented graphically as follows:
• Rectangles represent entity sets.
• Attributes listed inside entity rectangle
• Underline indicates primary key attributes
Amity School of Engineering & Technology

Relationship Sets
n Diamonds represent relationship sets.
Amity School of Engineering & Technology

Relationship Sets with Attributes


Amity School of Engineering & Technology

Cardinality Constraints
• We express cardinality constraints by drawing either a directed line (), signifying
“one,” or an undirected line (—), signifying “many,” between the relationship set
and the entity set.

• One-to-one relationship between an instructor and a student :


– A student is associated with at most one instructor via the relationship advisor
– A student is associated with at most one department via stud_dept
Amity School of Engineering & Technology

One-to-Many Relationship

• one-to-many relationship between an instructor and a student


– an instructor is associated with several (including 0) students via
advisor
– a student is associated with at most one instructor via advisor,
Amity School of Engineering & Technology

Many-to-One Relationships

• In a many-to-one relationship between an instructor and a student,


– an instructor is associated with at most one student via advisor,
– and a student is associated with several (including 0) instructors
via advisor
Amity School of Engineering & Technology

Many-to-Many Relationship

• An instructor is associated with several (possibly 0) students via


advisor
• A student is associated with several (possibly 0) instructors via
advisor
Amity School of Engineering & Technology

Total and Partial Participation


n Total participation (indicated by double line): every entity in the entity set participates in at
least one relationship in the relationship set

participation of student in advisor relation is total


4 every student must have an associated instructor
n Partial participation: some entities may not participate in any relationship in the relationship
set
l Example: participation of instructor in advisor is partial
Amity School of Engineering & Technology

Notation for Expressing More Complex Constraints

n A line may have an associated minimum and maximum cardinality, shown in the form l..h,
where l is the minimum and h the maximum cardinality
n A minimum value of 1 indicates total participation.
n A maximum value of 1 indicates that the entity participates in at most one relationship
n A maximum value of * indicates no limit.

Instructor can advise 0 or more students. A student must have 1 advisor; cannot
have multiple advisors
Amity School of Engineering & Technology

Notation to Express Entity with Complex Attributes


Amity School of Engineering & Technology

Expressing Weak Entity Sets

• In E-R diagrams, a weak entity set is depicted via a double rectangle.


• We underline the discriminator of a weak entity set with a dashed
line.
• The relationship set connecting the weak entity set to the identifying
strong entity set is depicted by a double diamond.
• Primary key for section – (course_id, sec_id, semester, year)
E-R Diagram for a University Enterprise
Amity School of Engineering & Technology
Amity School of Engineering & Technology

Summary of Symbols Used in E-R Notation


Amity School of Engineering & Technology

Symbols Used in E-R Notation (Cont.)


Amity School of Engineering & Technology

Alternative ER Notations
• Chen, IDE1FX, …
Amity School of Engineering & Technology

Alternative ER Notations
Chen IDE1FX (Crows feet notation)
Amity School of Engineering & Technology

Reduction to Relation Schemas


(transforming ER diagram into the tables)
Amity School of Engineering & Technology

Reduction to Relation Schemas


• Entity sets and relationship sets can be expressed uniformly
as relation schemas that represent the contents of the
database.
• A database which conforms to an E-R diagram can be
represented by a collection of schemas.
• For each entity set and relationship set there is a unique
schema that is assigned the name of the corresponding entity
set or relationship set.
• Each schema has a number of columns (generally
corresponding to attributes), which have unique names.
Amity School of Engineering & Technology

Representing Entity Sets


• A strong entity set reduces to a schema with the same attributes

student(ID, name, tot_cred)

• A weak entity set becomes a table that includes a column for the primary key of
the identifying strong entity set

section ( course_id, sec_id, sem, year )


Amity School of Engineering & Technology

Representing Relationship Sets


• A many-to-many relationship set is represented as a schema with
attributes for the primary keys of the two participating entity sets,
and any descriptive attributes of the relationship set.
• Example: schema for relationship set advisor

advisor = (s_id, i_id)


Amity School of Engineering & Technology

Representation of Entity Sets with Composite Attributes

• Composite attributes are flattened out by creating a separate


attribute for each component attribute
– Example: given entity set instructor with composite attribute
name with component attributes first_name and last_name the
schema corresponding to the entity set has two attributes
name_first_name and name_last_name
• Prefix omitted if there is no ambiguity (name_first_name
could be first_name)
• Ignoring multivalued attributes, extended instructor schema is
– instructor(ID,
first_name, middle_initial, last_name,
street_number, street_name,
apt_number, city, state, zip_code,
date_of_birth)
Amity School of Engineering & Technology

Representation of Entity Sets with Multivalued Attributes

• A multivalued attribute M of an entity E is represented by a separate


schema EM
• Schema EM has attributes corresponding to the primary key of E
and an attribute corresponding to multivalued attribute M
• Example: Multivalued attribute phone_number of instructor is
represented by a schema:
inst_phone= ( ID, phone_number)
• Each value of the multivalued attribute maps to a separate tuple of
the relation on schema EM
– For example, an instructor entity with primary key 22222 and
phone numbers 456-7890 and 123-4567 maps to two tuples:
(22222, 456-7890) and (22222, 123-4567)
Amity School of Engineering & Technology

Concept of Generalization, Aggregation and Specialization


• Using the ER model for bigger data creates a lot of complexity while designing a database model, So in
order to minimize the complexity Generalization, Specialization, and Aggregation were introduced in the
ER model and these were used for data abstraction in which an abstraction mechanism is used to hide
details of a set of objects.
• Some of the terms were added to the Enhanced ER Model, where some new concepts were added.
These new concepts are:
1. Generalization
2. Specialization
3. Aggregation
1. Generalization:-
• DBMS generalization is a database modeling technique that involves creating a higher-level abstraction
of similar entities in a database. It helps to simplify the database structure and improve data consistency
by grouping similar entities into a single higher-level entity. The higher-level entity is referred to as a
supertype, while the lower-level entities are referred to as subtypes.
• Generalization is the process of extracting common properties from a set of entities and creating a
generalized entity from it. It is a bottom-up approach in which two or more entities can be generalized to a
higher-level entity if they have some attributes in common

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Concept of Generalization
• For example, consider a database that contains information
about employees in a company. The employees can be
classified into two categories: permanent employees and
temporary employees. Instead of having two separate tables
for permanent and temporary employees, a generalization of
the two entities into a single entity called “EMPLOYEE” can
be created. The “EMPLOYEE” entity will have two subtypes:
“P_EMPLOYEE” and “T_EMPLOYEE”.

• DBMS generalization helps to reduce data redundancy,


improve data consistency, and simplify the database
structure by eliminating the need to create separate tables
for similar entities. Additionally, it provides a clear and
concise way to represent the relationships between entities
in a database.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Concept of Specialization

2. Specialization: Specialization in a DBMS is a database


modeling technique that involves creating a lower-level
abstraction of a higher-level entity in a database. It is the reverse
process of generalization, where a higher-level entity is divided
into smaller, more specific subtypes.
• In summary, specialization is a technique for creating a lower-
level abstraction of a higher-level entity in a database, and it
helps to improve the accuracy and consistency of data by
allowing for the representation of unique attributes and
relationships between entities.
For example, consider a database that contains information
about employees in a company. The employees can be
classified into two categories: permanent employees and
temporary employees. Instead of having a single table for
employees, a specialization of the “EMPLOYEE” entity into two
separate entities: “P_EMPLOYEE” and “T_EMPLOYEE” can be
created.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Specialization & Generalization Example


Amity School of Engineering & Technology
Concept of Aggregation
3. Aggregation: Aggregation in DBMS is a relationship between two
entities where one entity is a part of another entity. It is used to model a
whole-part relationship between entities in a database.
• Aggregation can be represented in an E-R diagram using an oval
shape with the name of the whole entity in the center and a line
connecting the whole entity to the part entities.
• Aggregation in DBMS helps to model complex relationships between
entities in a database, and it provides a way to represent the
relationship between a whole and its parts. Additionally, it helps to
improve data accuracy and consistency by ensuring that the parts of
an entity are properly related to the whole entity.
For example, consider a database that contains information about a car
manufacturing company. The company makes cars, and each car has
multiple parts such as an engine, wheels, and a body. The “CAR” entity
is the whole, and the “ENGINE,” “WHEEL,” and “BODY” entities are the
parts. The relationship between the “CAR” entity and the “ENGINE,”
“WHEEL,” and “BODY” entities is an aggregation relationship.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Data Models
• Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data. It provides the conceptual tools for describing the design of a database
at each level of data abstraction.
• Types of Data Models
1. Object-Oriented Data Model
• The object-oriented data model integrates object-oriented programming principles into
databases, allowing data to be stored as objects.
• This model is suitable for applications requiring complex data representations.
Characteristics:
• Object Structure: Data is represented as objects, similar to object-oriented programming
languages.
• Encapsulation: Combines data and behavior (methods) in objects.
• Inheritance: Supports inheritance of properties and methods.
Advantages:
• Seamless integration with object-oriented programming.
• Suitable for applications with complex data structures.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology
Data Models
Disadvantages:
• Complexity in implementation.
• It is less useful compared to the relational
model.
2. Hierarchical Data Model
• The hierarchical data model organizes data in a
treelike structure, where each record has a
single parent and one or more children.
• This model is ideal for representing data with a
clear hierarchical relationship, such as
organizational charts or file systems.
Characteristics:
• ParentChild Relationship: Each node (record) is
linked to a single parent.
• Navigational Access: Data retrieval involves
navigating through the hierarchy.
• Simplicity: Simple to understand and implement
for hierarchical data.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Data Models
Advantages:
• Efficient for queries that require traversing
hierarchies.
• Enforces data integrity through parent-child
relationships.
Disadvantages:
• Lack of flexibility: changes in the hierarchy
can be complex.
• Difficult to model many-to-many relationships.
3.Network Data Model
• The network data model is an extension of the
hierarchical model, allowing multiple parent-
child relationships, thus creating a graph
structure.
• This model is suitable for complex data
relationships.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Data Models
Characteristics:
• Graph Structure: Data is represented as a collection of records connected by links.
• Flexibility: Supports many-to-many relationships.
• Set-based access: Data can be accessed through predefined paths (sets).
Advantages:
• More flexible than the hierarchical model.
• Efficient for complex queries involving interconnected data.
Disadvantages:
• Complexity in implementation and maintenance.
• Navigational access can be cumbersome.
4. Relational Data Model
• The most widely used model is the relational model. According to this concept, data is kept in
two-dimensional tables. Data is organized into rows and columns. Tables are the cornerstone
of a relational paradigm. For this reason, in the model, the tables are referred to as relations.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

Data Models
Characteristics
• Triples: The term "tuple" refers to each row in the table. Every row contains every detail
pertaining to a single, unique instance. The information about each individual in the following
example is filled in a row; for example, the first row includes information about Ramesh.
• Field: A field or quality The characteristic that characterizes a table or connection is its
attribute. The values of the attributes have to be in the same domain. The characteristics of an
Employee in the example below, such as their address, age, and employee ID, are called
attributes.
Advantages Names employee Phone_No Address AGE
ID
1. Scalable: The user may easily add as many
rows and columns as they would like to this Ramesh 34 987654274 Pune 32
model. 5
2. Structural independence: It is feasible to Arya 27 923475488 Mumbai 22
change the database's structure without also 8
changing how information is accessed. Kumari 16 879845612 Pune 25
Structural independence is achieved if we 3
can change the database structure without Vishva 23 886534129 Pune 33
affecting the DBMS's capacity to access 8
data. Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology
Data Models
Disadvantages
1. Hardware Overheads: This paradigm requires more potent processors and data storage devices in order to
mask complexity and simplify user interfaces.
2. Improper Design: Users can access data without understanding how it is stored because the model is
incredibly simple to generate and use. A poor database could be created as a result of the design's simplicity,
and when the database grows, its growth might stall.

Advantages of Data Models


• We can accurately represent data with the use of data models.
• It assists us in reducing data redundancy and locating missing data.
• Data security is best provided by data models.
• The physical database should be constructed using the data model, which should have sufficient detail.
• Table relationships, main and foreign key relationships, and stored procedures can all be defined using the
information found in the data model.

Disadvantages of Data Models


• It might occasionally be challenging to comprehend the data model in the case of an extensive database.
• In order to use physical models, you need to be proficient with SQL.
• Modifications to even minor structural changes necessitate alterations to the entire application.
• A set language for data manipulation does not exist in DBMSs.
• Understanding the physical properties of data storage is necessary to construct data models.

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology
Assignment 1
1. Explain the fundamental concepts of a Database Management System (DBMS). How does a DBMS address the
limitations of file-based systems? Discuss the primary goals of a DBMS.
2. Identify the different types of database users and their roles. How do their needs and interactions with the database
differ?
3. Discuss the responsibilities of a Database Administrator (DBA). How does a DBA contribute to the overall efficiency,
security, and performance of a database system?
4. Explain the concept of database abstraction. Discuss the three levels of database abstraction (physical, logical, and
view levels) with suitable examples. Why is this abstraction important in database management?
5. Discuss the concept of relationship sets in the ER model. How do relationship sets differ from entity sets? Provide
examples to illustrate your answer.
6. Define and differentiate between generalization, aggregation, and specialization in the context of an ER model.
Provide examples of each and discuss their significance in database design.
7. Compare and contrast the object-oriented data model, network data model, and relational data model. What are the
advantages and disadvantages of each model?

Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Amity School of Engineering & Technology

End of Module 1

You might also like