0% found this document useful (0 votes)
26 views198 pages

Unit 1 DR - Mohd.nazim

The document outlines the course details for 'Introduction of Database & Conceptual Designing' at Noida Institute of Engineering and Technology, led by Dr. Mohd. Nazim. It includes information on course objectives, outcomes, evaluation schemes, and the relevance of database management systems in various applications. Additionally, it covers the Software Development Life Cycle (SDLC) phases, emphasizing the structured approach to software development.

Uploaded by

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

Unit 1 DR - Mohd.nazim

The document outlines the course details for 'Introduction of Database & Conceptual Designing' at Noida Institute of Engineering and Technology, led by Dr. Mohd. Nazim. It includes information on course objectives, outcomes, evaluation schemes, and the relevance of database management systems in various applications. Additionally, it covers the Software Development Life Cycle (SDLC) phases, emphasizing the structured approach to software development.

Uploaded by

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

Noida Institute of Engineering and Technology, Greater Noida

Introduction of Database
& Conceptual Designing

Unit: 1

BCSE0452
Dr. Mohd. Nazim
Assistant Professor
Course Details
(B Tech IVth Sem) CSE Department

6/15/2024 DBMS Unit-1 1


Faculty Introduction

Dr. Mohd. Nazim is an Assistant Professor at Computer

Science and Engineering Department, Noida Institute

of Engineering and Technology, Gr Noida. He has done

MTech from Dr. APJ Abdul Kalam Technical University,

Lucknow

His area of research includes Software Engineering and

Soft Computing Techniques. He has published research

paper in reputed journal and conference proceedings.

Teaching Experience : 9 years

02/08/202 DBMS Unit-1 2


5
Evaluation Scheme

02/08/2025 3
DBMS Unit-1
Syllabus

02/08/202 DBMS Unit-1 4


5
Syllabus

02/08/202 DBMS Unit-1 5


5
Syllabus

02/08/202 DBMS Unit-1 6


5
Syllabus

02/08/202 DBMS Unit-1 7


5
Syllabus

02/08/202 DBMS Unit-1 8


5
Syllabus

02/08/202 DBMS Unit-1 9


5
Branch wise Applications

There are various application of DBMS in different fields like Railway


Reservation System, Library Management System, Banking, Universities and
colleges, Credit card transactions etc

02/08/20 DBMS Unit-1 10


25
Course Objective
• The objective of course is to present an introduction to database
management systems, with an emphasis on how to organize,
maintain and retrieve-efficiently, and effectively –information in
relational and non-relational Database.
• List and explain the fundamental concepts of a relational database
system
• Knowledge of DBMS, both in terms of use
and implementation/design.
• Experience with SQL and Manipulate a database using SQL
• Increased proficiency with the programming language C++.
• Experience working as part of team v Experience with analysis and
design of (DB) software
• Assess the quality and ease of use of data modeling
and diagramming tools.
02/08/2025 DBMS Unit-1 11
Course Outcomes

02/08/2025 DBMS Unit-1 12


Program Outcomes
Engineering Graduates will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of
complex engineering problems.

2. Problem analysis: Identify, formulate, review research literature, and analyze


complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.

3. Design/development of solutions: Design solutions for complex engineering


problems and design system components or processes that meet the specified
needs with appropriate consideration for the public health and safety, and the
cultural, societal, and environmental considerations.

4. Conduct investigations of complex problems: Use research-based knowledge


and research methods including design of experiments, analysis and interpretation
of data, and synthesis of the information to provide valid conclusions.

02/08/20 DBMS 13
25
Program Outcomes
Engineering Graduates will be able to:
5. Modern tool usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
modeling to complex engineering activities with an understanding of the
limitations.
6. The engineer and society: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues and the
consequent responsibilities relevant to the professional engineering practice.

7. Environment and sustainability: Understand the impact of the professional


engineering solutions in societal and environmental contexts, and demonstrate
the knowledge of, and need for sustainable development.

8. Ethics: Apply ethical principles and commit to professional ethics and


responsibilities and norms of the engineering practice.

02/08/20 DBMS 14
25
Program Outcomes
Engineering Graduates will be able to:
9. Individual and team work: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.

10. Communication: Communicate effectively on complex engineering activities


with the engineering community and with society at large, such as, being able to
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and
understanding of the engineering and management principles and apply these
to one’s own work, as a member and leader in a team, to manage projects and
in multidisciplinary environments.

12. Life-long learning: Recognize the need for, and have the preparation and ability
to engage in independent and life-long learning in the broadest context of
technological change.

02/08/20 DBMS 15
25
COs and POs Mapping

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

BCSE0452.1

2 3 3 3 2 1 - 1 2 - 2 2
BCSE0452.2

3 2 3 3 2 2 - 2 1 2 2 2
BCSE0452.3

3 3 2 3 3 2 - 2 1 - 2 2
BCSE0452.4

3 2 3 2 2 2 - - 2 2 2 3
BCSE0452.5

2 2 2 2 2 2 - - 1 2 1 2

AVG
2.6 2.4 2.6 2.6 2.2 1.8 - 1.67 1.4 2.0 1.8 2.2

02/08/2025 DBMS 16
Program Specific Outcomes (PSOs)

On successful completion of graduation degree the Computer Science & Engineering


graduates will be able to:

PSO1:
Identify, analyze real world problems and design their ethical solutions using artificial
intelligence, robotics, virtual/augmented reality, data analytics, block chain technology, and
cloud computing.
PSO2:
Design and develop the hardware sensor devices and related interfacing software systems
for solving complex engineering problems.
PSO3:
Understand inter-disciplinary computing techniques and to apply them in the design of
advanced computing.
PSO4:
Conduct investigation of complex problems with the help of technical, managerial, leadership
qualities, and modern engineering tools provided by industry-sponsored laboratories.

02/08/2025 DBMS 17
COs and PSOs Mapping

Program Specific Outcomes


PSO1 PSO2 PSO3 PSO4

BCSE0452.1
3
3 1 3
BCSE0452.2 2
3 1 3
BCSE0452.3 2
3 2 2
BCSE0452.4 2
3 2 2
BCSE0452.5 2
3 2 2
Average 3 1.6 2.4 2.2

02/08/2025 DBMS 18
Program Educational Objectives (PEOs)

PEO1: To have an excellent scientific and engineering breadth so as to comprehend,


analyze, design and provide sustainable solutions for real-life problems using state-
of-the-art technologies.

PEO2: To have a successful career in industries, to pursue higher studies or to support


entrepreneurial endeavors and to face the global challenges.

PEO3: To have an effective communication skill, professional attitude, ethical values


and a desire to learn specific knowledge in emerging trends, technologies for
research, innovation and product development and contribution to society.

PEO4: To have life-long learning for up-skilling and re-skilling for a successful
professional career as an engineer, scientist, entrepreneur or bureaucrat for the
betterment of the society.

02/08/2025 DBMS 19
Result Analysis

02/08/20 DBMS 20
25
Question Paper Template

02/08/20 DBMS 21
25
Question Paper
Template SECTION – A CO

1. Attempt all parts- [10×1=10]

1-a. Question- (1)


1-b. Question- (1)
1-c. Question- (1)
1-d. Question- (1)
1-e. Question- (1)
1-f. Question- (1)
1-g. Question- (1)
1-h. Question- (1)
1-i. Question- (1)
1-j. Question- (1)

2. Attempt all parts- [5×2=10] CO

2-a. Question- (2)


2-b. Question- (2)
2-c. Question- (2)
2-d. Question- (2)
2-e. Question- (2)

SECTION – B CO

3. Answer any five of the following- [5×6=30]


3-a. Question- (6)
3-b. Question- (6)
3-c. Question- (6)
3-d. Question- (6)
3-e. Question- (6)
3-f. Question- (6)
3-g. Question- (6)

02/08/20 DBMS 22
22
25
Question Paper
Template
SECTION – C CO

4 Answer any one of thefollowing- [5×10=50]

4-a. Question- (10)

4-b. Question- (10)


5. Answer any one of thefollowing-
5-a. Question- (10)

5-b. Question- (10)


6. Answer any one of thefollowing-
6-a. Question- (10)

6-b. Question- (10)


7. Answer any one of thefollowing-
7-a. Question- (10)

7-b. Question- (10)

8. Answer any one of thefollowing-


8-a. Question- (10)

8-b. Question- (10)

02/08/20 DBMS 23
25
Prerequisite and Recap

• There is No prerequisite for learning DBMS from scratch although having


basic knowledge of discrete mathematics and data structure is added
advantage.

• Having knowledge of basic mathematics like - SUM,


DIFFERENCE, AVERAGE, MEAN, MEDIAN, MODE, etc
will
definitely be a plus point.
• Having knowledge on Set Theory will help.
• The proper understanding of data structures (B and B+ trees) will help
you to understand the DBMS quickly.

02/08/20 DBMS 24
25
Brief Introduction about the Subject

1. A database management system (DBMS) refers to the technology for


creating and managing databases. DBMS is a software tool to organize
(create, retrieve, update, and manage) data in a database.
2. The main aim of a DBMS is to supply a way to store up and retrieve
database information that is both convenient and efficient. By data,
we mean known facts that can be recorded and that have embedded
meaning.
3. Usually, people use software such as DBASE IV or V, Microsoft ACCESS,
or EXCEL to store data in the form of a database. A datum is a unit of
data. Meaningful data combined to form information. Hence,
information is interpreted data - data provided with semantics. MS.
ACCESS is one of the most common examples of database
management software.

Video Link:
www.youtube.com/watch?v=3EJlovevfcA&t=436s
02/08/20 DBMS 25
25
Content – Unit 1

• Introduction: An overview of database management system,


database system Vs file system, Database system concept and
architecture, data model schema and instances, data independence
and database language and interfaces, data definitions language,
DML.
• Data Modeling using the Entity Relationship Model: ER
model concepts, notation for ER diagram, mapping
constraints,

02/08/20 DBMS 26
25
Unit Objective

1. The main objectives of database management system are data


availability, data integrity, data security, and data independence.

2. DDL stands for Data Definition Language. DML stands for Data
Manipulation Language. DDL statements are used to create
database, schema, constraints, users, tables etc. DML statement is
used to insert, update or delete the records.

3. ER diagrams are used to analyze existing databases to find and


resolve problems in logic or deployment. Drawing the diagram
should reveal where it's going wrong. Business information systems:
The diagrams are used to design or analyze relational databases
used in business processes.

02/08/20 DBMS 27
25
Introduction of SDLC

• The Software Development Life Cycle (SDLC) is a structured


process followed for the development of software.
• It outlines a systematic approach to planning, designing,
developing, testing, deploying, and maintaining software
applications.
• The primary goal of SDLC is to ensure that high-quality
software is delivered within budget, on time, and according
to specified requirements.

02/08/20 DBMS 28
25
Introduction of SDLC

Key Phases of SDLC

1. Requirement Analysis
1. The most critical phase where stakeholders, project managers, and
analysts gather and analyze business needs.
2. The outcome is a detailed Software Requirements Specification
(SRS) document.
2. Planning
1. Focuses on defining the project scope, timelines, costs, and
resources.
2. A feasibility study is conducted to determine the technical,
operational, and economic viability of the project.
3. System Design
1. Architects and designers create the overall system design, including
UI/UX, database structure, and system architecture.
2. High-Level Design (HLD) and Low-Level Design (LLD) documents are
produced.
02/08/20 DBMS 29
25
Introduction of SDLC

Key Phases of SDLC

4. Development (Coding)
1. Developers write the actual code based on design specifications.
2. Different coding standards and programming languages are chosen
according to the project requirements.

5. Testing
1. The developed software is rigorously tested for bugs, errors, and
functionality mismatches.
2. Testing types include unit testing, integration testing, system
testing, and user acceptance testing (UAT).

02/08/20 DBMS 30
25
Introduction of SDLC

Key Phases of SDLC

6. Deployment
1. The software is deployed to a production environment for use by end
users.
2. This may involve installing the software, configuring it, and providing
user training.

7. Maintenance
3. Post-deployment, the software requires updates, bug fixes, and
enhancements to adapt to changing user needs or technologies.
4. Ensures the longevity and relevance of the software.

02/08/20 DBMS 31
25
Data and Information
Data
• Raw, unprocessed facts and figures without any context.
• It can be numeric, textual, or in other forms and does not carry meaning
by itself.
• Examples:
Numbers: 123, 456
Text: "John", "Delhi“
Date: 2025-01-07

Information
• Processed, structured, or interpreted data that provides meaning or
context, making it useful for decision-making.
• Examples:
Data: 123, John, Delhi
Information: "John (ID: 123) lives in Delhi"

02/08/20 DBMS 32
25
What is DBMS

• A very large, integrated collection of related data.


• Models real-world enterprise.
– Entities (e.g., students, courses)
– Relationships (e.g., Madonna is taking CS564)

• A Database Management System (DBMS) is a software


package
designed to define,construct and manipulate database.
• Database + Database Management System= Database System.

02/08/20 DBMS 33
25
Why use DBMS

• Data independence and efficient access.


• Reduced application development time.
• Data integrity and security.
• Uniform data administration.
• Concurrent access, recovery from crashes.

02/08/20 DBMS 34
25
History of DBMS

1. Early Data Storage (Before 1960s)


Paper Records:
• Data was stored manually on paper in files and cabinets.
• Searching and retrieving information was slow and error-prone.

Punch Cards: Early computers used punch cards to store and process data,
but this method was cumbersome and limited.

2. File-Based Systems (1960s)


• Computers began storing data in files.
• Files were created for different tasks but had problems like:
• Data duplication (same data stored in multiple files).
• Difficulty in updating and retrieving related information.
• These limitations led to the need for a more efficient way to manage
data.
02/08/20 DBMS 35
25
History of DBMS
3. First Database Systems (1970s)

•Hierarchical Databases:
• Data was organized like a tree (parent-child relationships).
• Example: IBM’s IMS (Information Management System).
• Limitation: Rigid structure, hard to handle complex relationships.

•Network Databases:
• Data was connected using a flexible graph structure (many-to-many
relationships).
• Example: CODASYL DBTG (Database Task Group).
• Limitation: Complex to manage and query

02/08/20 DBMS 36
25
History of DBMS

4. Relational Databases (1980s)

• Dr. E.F. Codd (1970) introduced the Relational Model, which became the
foundation for modern databases.
• Data was stored in tables (relations) with rows and columns.
• Advantages:
• Easier to understand and manage.
• Queries could be written using SQL (Structured Query Language).
• Popular systems: Oracle, MySQL, PostgreSQL, Microsoft SQL Server.

5. Object-Oriented Databases (1990s)

• Combined database concepts with object-oriented programming.


• Supported complex data types (e.g., images, videos).
• Example: ObjectStore, ObjectDB.
• Limitation: Not widely adopted compared to relational databases.

02/08/20 DBMS 37
25
History of DBMS
6. NoSQL Databases (2000s)

• With the rise of big data and web applications, traditional relational
databases struggled with scalability.
• NoSQL (Not Only SQL) databases emerged, designed to handle:
• Large amounts of unstructured or semi-structured data.
• High-speed read/write operations.

Types:
• Document databases (e.g., MongoDB).
• Key-Value stores (e.g., Redis).
• Column-family stores (e.g., Cassandra).
• Graph databases (e.g., Neo4j).

02/08/20 DBMS 38
25
History of DBMS

7. Cloud and Distributed Databases (2010s–Present)

• Cloud Databases: Hosted on platforms like AWS, Azure, and Google


Cloud, allowing on-demand scaling and reduced costs.
• Distributed Databases: Spread data across multiple servers for better
performance and reliability.
• Examples: Amazon DynamoDB, Google BigQuery.

8. Modern Trends (2020s and Beyond)

• AI and Machine Learning Integration: Databases now support


advanced analytics and predictive modeling.
• Multi-Model Databases: Support different types of data (relational,
graph, document) in a single system.
• Blockchain Databases: Focused on secure, decentralized data storage.

02/08/20 DBMS 39
25
Why we study DBMS

⚫ Shift from computation to information


at the “low end”: scramble to webspace (a mess!)

⚫ at the “high end”: scientific applications

⚫ Datasets increasing in diversity and volume.


⚫ Digital libraries, interactive video, Human Genome project,
EOS
project
⚫ ... need for DBMS exploding

⚫ DBMS encompasses most of


CS
⚫ OS, languages, theory, AI,
multimedia, logic

02/08/20 DBMS 40
25
Advantage of DBMS

⚫ Controlling Redundancy
⚫ Restricting Unauthorized Access
⚫ Provide storage structures for efficient query processing
⚫ Backup and Recovery
⚫ Support concurrent access
⚫ Multiple user interfaces
⚫ Represent complex relationship among data
⚫ Enforcing Integrity constraints

02/08/2025 DBMS 41
Files vs.
DBMS
• Application must stage large datasets between main memory and
secondary storage (e.g., buffering, page-oriented access, 32-bit
addressing, etc.)
• Special code for different queries
• Must protect data from inconsistency due to multiple concurrent
users
• Crash recovery
• Security and access control

02/08/2025 DBMS 42
Purpose of Database Systems
⚫ In the early days, database applications were built directly on top of
file systems
⚫ Drawbacks of using file systems to store data:
⚫ Data redundancy and inconsistency
⚫ Multiple file formats, duplication of information in different
files
⚫ Difficulty in accessing data
⚫ Need to write a new program to carry out each new task
⚫ Data isolation — multiple files and formats
⚫ Integrity problems
⚫ Integrity constraints (e.g. account balance >
0) become
“buried” in program code rather than being stated explicitly
⚫ Hard to add new constraints or change existing ones
02/08/2025 DBMS 43
Purpose of Database Systems (Cont.)

• Drawbacks of using file systems (cont.)


– Atomicity of updates
• Failures may leave database in an inconsistent
state with
partial updates carried out
• Example: Transfer of funds from one account
to another
should either complete or not happen at all
– Concurrent access by multiple users
• Concurrent access needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
– Example: Two people reading a balance and updating it
at the same time
– Security problems
• Hard to provide user access to some, but not all, data
• Database systems offer solutions to allDBMS
02/08/20
25
the above problems 44
Database Users

Users are differentiated by the way they expect to interact with


the system
• Application programmers – interact with system through DML calls
• Sophisticated users – form requests in a database query language
• Specialized users – write specialized database applications that do
not fit into the traditional data processing framework
• Naïve users – invoke one of the permanent application programs
that have been written previously
– Examples, people accessing database over the web, bank tellers,
clerical staff

02/08/20 DBMS 45
25
Database Administrator

• Coordinates all the activities of the database system


– has a good understanding of the information
enterprise’s
resources and needs.
• Database administrator's duties include:
– Storage structure and access method definition
– Schema and physical organization modification
– Granting users authority to access the database
– Backing up data
– Monitoring performance and responding to changes
• Database tuning

02/08/20 DBMS 46
25
Database System Concepts
Key concepts of database systems:

1. Database : A structured collection of data.

2. DBMS (Database Management System) : Software that manages and interacts


with databases (e.g., MySQL, Oracle).

3. Data Model : Framework for organizing data (e.g., Relational Model, ER Model).

4. Schema : The structure of the database, defined by tables, columns, and


relationships.

5. SQL (Structured Query Language) : Language for managing and manipulating


databases (includes DDL, DML, DCL).
6. Normalization : Process of organizing data to reduce redundancy and improve
integrity.

7. Transactions : A sequence of operations treated as a single unit, ensuring ACID


properties (Atomicity, Consistency, Isolation, Durability).
02/08/20 DBMS 47
25
Database System Concepts

8. Indexes: Data structures that speed up data retrieval.

9. Views : Virtual tables representing data from one or more tables.

10. Joins : Operations to retrieve related data from multiple tables (e.g., INNER JOIN,
LEFT JOIN).

11. NoSQL Databases : Non-relational databases for unstructured data (e.g.,


MongoDB, Redis).

12. Data Warehousing : Systems for reporting and analyzing large volumes of
historical data.

13. Big Data : Large datasets managed with technologies like Hadoop and Spark.

14. Data Mining : Discovering patterns and knowledge from large datasets.

15. Database Security : Measures to protect the database, including authentication,


authorization, and encryption.
02/08/20 DBMS 48
25
Data Models

A data model is a conceptual framework that describes how


data is organized, stored, and accessed in a database. It defines
the structure of the database and the relationships among the
data elements.

Why Use Data Models?


Organized Structure: Ensures data is stored systematically.
Clarity: Helps developers, database administrators, and users
understand the database design.
Flexibility: Makes it easier to adapt to changes in
requirements.
Efficiency: Enhances data retrieval and storage processes.

02/08/20 DBMS 49
25
Types of Data Models

Data models are generally categorized into three types based


on their abstraction levels:

1. Conceptual Data Model


2. Logical Data Model
3. Physical Data Model

02/08/20 DBMS 50
25
Types of Data Models

1. Conceptual Data Model


•Purpose: Represents the high-level structure of data in a
database.
•Focus: What data should be stored and the relationships
between data.
•Audience: Used by business stakeholders and database
designers.
•Example: Entity-Relationship (ER) model.
• Entities: Objects or things (e.g., Student, Course).
• Attributes: Details about entities (e.g., Student Name,
Course ID).
• Relationships: Connections between entities (e.g.,
Student enrolls in Course).
02/08/20 DBMS 51
25
Types of Data Models

2. Logical Data Model

• Purpose: Details how the data will be structured logically.


• Focus: The logical organization of data, independent of how
it will be stored.
• Audience: Used by database designers.
• Example:
• Tables (relations) for entities.
• Columns for attributes.
• Primary and foreign keys for relationships.

02/08/20 DBMS 52
25
Types of Data Models

3. Physical Data Model

• Purpose: Defines how data is stored physically in the


database.
• Focus: Storage details, indexing, partitioning, and
performance optimization.
• Audience: Used by database administrators.
• Example: Detailed schema with storage settings like data
types, constraints, and indexes.

02/08/20 DBMS 53
25
Specific Types of Data Models

Based on their structure, databases can follow these specific


data models:
1. Hierarchical Data Model
2. Network Data Model
3. Relational Data Model
4. Entity-Relationship (ER) Model
5. Object-Oriented Data Model
6. Document Data Model
7. Key-Value Data Model
8. Graph Data Model

02/08/20 DBMS 54
25
Specific Types of Data Models

1. Hierarchical Data Model


•Structure: Organizes data in a tree-like hierarchy with parent-child
relationships.
•Example:
• Parent: Department.
• Children: Employees in the department.
•Use Case: Early mainframe systems.
•Limitation: Rigid structure; difficult to handle complex relationships.

2. Network Data Model


•Structure: Uses a graph-like structure with many-to-many relationships.
•Example:
• A student can enroll in multiple courses, and a course can have
multiple students.
•Use Case: Manufacturing and inventory systems.
•Limitation: Complex querying.

02/08/20 DBMS 55
25
Specific Types of Data Models

3. Relational Data Model


•Structure: Organizes data in tables with rows and columns.
•Key Features:
• Primary Key: Uniquely identifies a row.
• Foreign Key: Links tables together.
•Use Case: Widely used in modern applications.
•Example: MySQL, Oracle, PostgreSQL.

4. Entity-Relationship (ER) Model


•Structure: Focuses on entities, attributes, and relationships.
•Use Case: Conceptual design phase of databases.
•Tool: ER diagrams to visualize the model.

02/08/20 DBMS 56
25
Specific Types of Data Models

5. Object-Oriented Data Model


•Structure: Integrates object-oriented programming concepts with
databases.
•Key Features:
• Supports complex data types (e.g., multimedia).
• Data is stored as objects.
•Use Case: Applications requiring multimedia or scientific data.

6. Document Data Model


•Structure: Stores data as documents, typically in JSON or BSON
formats.
•Key Features:
• Schema-less structure.
• Flexible and easy to scale.
•Use Case: NoSQL databases like MongoDB.

02/08/20 DBMS 57
25
Specific Types of Data Models

7. Key-Value Data Model


•Structure: Stores data as key-value pairs.
•Key Features:
• Simple and fast.
•Use Case: Caching systems, session storage (e.g., Redis, DynamoDB).

8. Graph Data Model


•Structure: Uses nodes (entities) and edges (relationships).
•Key Features:
• Excellent for representing interconnected data.
•Use Case: Social networks, recommendation systems (e.g., Neo4j).

02/08/20 DBMS 58
25
Schemas and Instances

• Similar to types and variables in programming languages


• Schema – the logical structure of the database
– Example: The database consists of information about a set of
customers and accounts and the relationship between them
– Analogous to type information of a variable in a program

• Instance – the actual content of the database at a particular point


in time
– Analogous to the value of a variable

02/08/20 DBMS 59
25
Levels of Abstraction

• Physical Schema/Level: describes how a record (e.g., customer) is


stored.
• Logical Schema/Level: describes data stored in database, and the
relationships among the data.
type customer = record
customer_id : string;
customer_name : string;
customer_street :
string; customer_city :
string;
end;
• External Schema/Level: application programs hide details of data
types. Views can also hide information (such as an employee’s
salary) for security purposes.
02/08/20 DBMS 60
25
Levels of Abstraction

• Three Schema Architecture for a Database System

02/08/20 DBMS 61
25
Example: University Database

 Physical schema:
 Relations stored as unordered files.
 Index on first column of Students.
 Conceptual schema:
 Students(sid: string, name: string, login: string, age: integer, gpa:real)
 Courses(cid: string, cname:string, credits:integer)
 Enrolled(sid:string, cid:string, grade:string)
 External Schema (View):
 View1- Course_info(cid:string,enrollment:integer)
 View2-studeninfo(id:int. name:string)

02/08/20 DBMS 62
25
Relational Database Terms

1. Relation
•A relation is a table in the database.
•It consists of rows and columns.
•Example:
A "Students" table is a relation.

2. Tuple
• A tuple is a single row in a table.
• Each row contains information about one instance.
• Example:In the "Students" table above:(101, John, 20) is
a tuple.

02/08/20 DBMS 63
25
Relational Database Terms

3. Attribute
• An attribute is a column in a table.
• It represents a property of the data.
• Example:
In the "Students" table:
• Roll Number, Name, and Age are attributes.
4. Domain
• A domain is the set of all possible values an attribute can
take.
• Example:
• For the Age attribute, the domain could be all positive
integers (e.g., 18–100).
• For the Name attribute, the domain could be all strings
02/08/20
of text. DBMS 64
25
Codd’s 12 Rule

02/08/20 DBMS Unit-1 65


25
Codd’s 12 Rule

Rule 0: The Foundation Rule


The database must be in relational form. So that the system can handle the
database through its relational capabilities.
Rule 1: Information Rule
A database contains various information, and this information must be stored in
each cell of a table in the form of rows and columns.
Rule 2: Guaranteed Access Rule
Every single or precise data (atomic value) may be accessed logically from a
relational database using the combination of primary key value, table name, and
column name.
Rule 3: Systematic Treatment of Null Values
This rule defines the systematic treatment of Null values in database records. The
null value has various meanings in the database, like missing the data, no value in
a cell, inappropriate information, unknown data and the primary key should not
be null.

02/08/20 DBMS Unit-1 66


25
Codd’s 12 Rule
Rule 4: Active/Dynamic Online Catalog based on the relational model
It represents the entire logical structure of the descriptive database that must be
stored online and is known as a database dictionary. It authorizes users to access
the database and implement a similar query language to access the database.
Rule 5: Comprehensive Data Sub Language Rule
The relational database supports various languages, and if we want to access the
database, the language must be the explicit, linear or well-defined syntax,
character strings and supports the comprehensive:
Data definition
View definition
Data manipulation
Integrity constraints
Transaction boundaries (begin, commit and rollback)
Rule 6: View Updating Rule
All views table can be theoretically updated and must be practically updated by
the database systems.

02/08/20 DBMS Unit-1 67


25
Codd’s 12 Rule

Rule 8: Physical Data Independence Rule


All stored data in a database or an application must be physically independent to
access the database. Each data should not depend on other data or an
application. If data is updated or the physical structure of the database is
changed, it will not show any effect on external applications that are accessing
the data from the database.
Rule 9: Logical Data Independence Rule
It is similar to physical data independence. It means, if any changes occurred to
the logical level (table structures), it should not affect the user's view
(application). For example, suppose a table either split into two tables, or two
table joins to create a single table, these changes should not be impacted on the
user view application.
Rule 10: Integrity Independence Rule
A database must maintain integrity independence when inserting data into
table's cells using the SQL query language. All entered values should not be
changed or rely on any external factor or application to maintain integrity. It is
also helpful in making the database-independent for each front-end application.

02/08/20 DBMS Unit-1 68


25
Codd’s 12 Rule
Rule 11: Distribution Independence Rule
The distribution independence rule represents a database that must work
properly, even if it is stored in different locations and used by different end-users.
Suppose a user accesses the database through an application; in that case, they
should not be aware that another user uses particular data, and the data they
always get is only located on one site. The end users can access the database, and
these access data should be independent for every user to perform the SQL
queries.
Rule 12: Non Subversion Rule
The non-submersion rule defines RDBMS as a SQL language to store and
manipulate the data in the database. If a system has a low-level or separate
language other than SQL to access the database system, it should not subvert or
bypass integrity to transform data.

02/08/20 DBMS Unit-1 69


25
Topic- ER Model Objective

1. An entity relationship diagram gives a snapshot of how these entities


relate to each other. You could call it the blueprint that underpins your
business architecture, offering a visual representation of the
relationships between different sets of data (entities).

2. An Entity Relationship (ER) Diagram is a type of flowchart


that illustrates how “entities” such as people, objects or concepts
relate to each other within a system.

70
02/08/20
25
Introduction of ER Model

• A database can be modeled as:


– a collection of entities,
– relationship among entities.
• An entity is an object that exists and is distinguishable from other
objects.

– Example: specific person, company, event, plant


• Entities have attributes
– Example: people have names and addresses

• 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
02/08/20 DBMS 71
25
Entity Sets customer and
loan
customer_id customer_ customer_ customer_ loan_ amount
name street city number

02/08/20 DBMS 72
25
Attributes
• An entity is represented by a set of attributes, that is descriptive
properties possessed by all members of an entity set.
Example: customer = (customer_id, customer_name,
customer_street, customer_city )
loan = (loan_number, amount )

• In ER diagram, attribute is represented by an oval.

• Domain – the set of permitted values for each attribute

02/08/20 DBMS 73
25
Attribute
Type
• Key Attribute – The attribute which uniquely identifies each entity
in the entity set is called key attribute. For example, Roll_No will be
unique for each student. In ER diagram, key attribute is represented
by an oval with underlying lines.

• Composite Attribute – An attribute composed of many other


attribute is called as composite attribute. For example, Address
attribute of student Entity type consists of Street, City, State, and
Country. In ER diagram, composite attribute is represented by an
oval comprising of ovals.

02/08/20 DBMS 74
25
Attribute
Type
• Multivalued Attribute – An attribute consisting more than one
value for a given entity. For example, Phone_No (can be more than
one for a given student). In ER diagram, multivalued attribute is
represented by double oval.

• Derived Attribute – An attribute which can be derived from other


attributes of the entity type is known as derived attribute. e.g.; Age
(can be derived from DOB). In ER diagram, derived attribute is
represented by dashed oval.

02/08/20 DBMS 75
25
Attribute
Type
• The complete entity type Student with its attributes can
be represented as:

02/08/20 DBMS 76
25
Relationship
Type
• A relationship type represents the association between
entity types.

• For example, ‘Enrolled in’ is a relationship type that exists between


entity type Student and Course.

• In ER diagram, relationship type is represented by a diamond and


connecting the entities with lines.

02/08/20 DBMS 77
25
Relationship
Set
• A set of relationships of same type is known as relationship set.

• The following relationship set depicts S1 is enrolled in C2, S2


is enrolled in C1 and S3 is enrolled in C3.

02/08/20 DBMS 78
25
Degree of Relationship
Set

• The number of different entity sets participating in a relationship


set is called as degree of a relationship set.

– Unary Relationship
– Binary Relationship
– n-ary Relationship

02/08/20 DBMS 79
25
Unary Relationship

• When there is only ONE entity set participating in a relation, the


relationship is called as unary relationship.

• For example, one person is married to only one person.

02/08/20 DBMS 80
25
Binary Relationship

• When there are TWO entities set participating in a relation, the


relationship is called as binary relationship.

• For example, Student is enrolled in Course.

02/08/20 DBMS 81
25
n-ary Relationship

• When there are n entities set participating in a relation,


the relationship is called as n-ary relationship.

02/08/20 DBMS 82
25
Mapping
Cardinality

• The number of times an entity of an entity set participates in a


relationship set is known as cardinality.

• Cardinality can be of different types:


– One to one
– One to many
– Many to one
– Many to many

02/08/20 DBMS 83
25
One to one

• When each entity in each entity set can take part only once in the
relationship, the cardinality is one to one. Let us assume that a
male can marry to one female and a female can marry to one male.
So the relationship will be one to one.

• Using Sets, it can be represented as:

02/08/20 DBMS 84
25
Many to one

• When entities in one entity set can take part only once in the
relationship set and entities in other entity set can take part more
than once in the relationship set, cardinality is many to one

• Using Sets, it can be represented as:

02/08/20 DBMS 85
25
Many to many

• When entities in all entity sets can take part more than once in the
relationship cardinality is many to many. Let us assume that a
student can take more than one course and one course can be
taken by many students. So the relationship will be many to many.

• Using sets, it can be represented as:

02/08/20 DBMS 86
25
Participation
Constraint
• Total Participation – Each entity in the entity set must participate in
the relationship. If each student must enroll in a course, the
participation of student will be total. Total participation is shown by
double line in ER diagram.
• Partial Participation – The entity in the entity set may or may NOT
participate in the relationship. If some courses are not enrolled by
any of the student, the participation of course will be partial.

02/08/20 DBMS 87
25
Participation Constraint
(contd..)

• Using set, it can be represented as

• Every student in Student Entity set is participating in relationship


but there exists a course C4 which is not taking part in the
relationship.

02/08/20 DBMS 88
25
Weak Entity Type & Identifying
Relationship
• An entity type has a key attribute which uniquely identifies each
entity in the entity set.
• But there exists some entity type for which key attribute can’t be
defined. These are called Weak Entity type.
• For example, A company may store the information of dependents
(Parents, Children, Spouse) of an Employee.
• But the dependents don’t have existence without the employee.
• So Dependent will be weak entity type and Employee will
be
Identifying Entity type for Dependent.

02/08/20 DBMS 89
25
Weak Entity Type & Identifying Relationship

• A weak entity type is represented by a double rectangle. The


participation of weak entity type is always total. The relationship
between weak entity type and its identifying strong entity type is
called identifying relationship and it is represented by double
diamond.

02/08/20 DBMS 90
25
Example of ER Diagram

02/08/20 DBMS 91
25
ER Diagram

Examples

02/08/20 DBMS Unit-1 92


25
ER Diagram For Department

02/08/20 DBMS Unit-1 93


25
ER Diagram for Company

02/08/20 DBMS Unit-1 94


25
Mapping Constraints in ER Diagrams

Mapping constraints define the number of instances of one


entity that can be associated with another.
1.Cardinality:
1. 1:1 (One-to-One): One entity is associated with one
other entity.
1.Example: A person has one passport.
2. 1:N (One-to-Many): One entity is associated with many
others.
1.Example: A teacher teaches many students.
3. M:N (Many-to-Many): Many entities are associated
with many others.
1.Example: Students enroll in many courses, and
courses have many students.

02/08/20 DBMS 95
25
Reducing ER Diagrams to Tables

To implement an ER model in a relational database, it needs


to be converted into tables.
1.Entities:
1. Strong entities become tables with their attributes as
columns.
2. Weak entities include a foreign key referencing the
primary key of their strong entity.
2.Relationships:
1. 1:1 Relationships: Add a foreign key to either table.
2. 1:N Relationships: Add a foreign key in the table on the
"many" side.
3. M:N Relationships: Create a new table to represent the
relationship, including foreign keys from both entities.

02/08/20 DBMS 96
25
Reduction of an ER diagrams to tables Rule-01

Rule-01: For Strong Entity Set With Only Simple Attributes


• A strong entity set with only simple attributes will require only
one table in relational model.
– Attributes of the table will be the attributes of the entity set.
– The primary key of the table will be the key attribute of
the entity set.

Schema : Student ( Roll_no , Name , Sex )

02/08/202 DBMS Unit-1 97


5
Rule-02

Rule-02: For Strong Entity Set With Composite Attributes


• A strong entity set with any number of composite attributes will
require only one table in relational model.
• While conversion, simple attributes of the composite attributes are
taken into account and not the composite attribute itself.

Schema : Student ( Roll_no , First_name , Last_name , House_no , Street ,


City )
02/08/202 DBMS Unit-1 98
5
Rule-03
Rule-03: For Strong Entity Set With Multi Valued Attributes
• A strong entity set with any number of multi valued attributes will
require two tables in relational model.
– One table will contain all the simple attributes with the primary
key.
– Other table will contain the primary key and all the multi valued
attributes.

Roll_no City Roll_no Mobile_no

02/08/202 DBMS Unit-1 99


5
RULE-04
Rule-04: Translating Relationship Set into a Table
• A relationship set will require one table in the relational model.
• Attributes of the table are-
– Primary key attributes of the participating entity sets
– Its own descriptive attributes if any.
– Set of non-descriptive attributes will be the primary key.

Schema : Works in ( Emp_no , Dept_id ,


since )
02/08/20 DBMS Unit-1 100
25
RULE-05

Rule-05: For Binary Relationships With Cardinality Ratios

• The following four cases are possible-

– Case-01: Binary relationship with cardinality ratio m:n

– Case-02: Binary relationship with cardinality ratio 1:n

– Case-03: Binary relationship with cardinality ratio m:1

– Case-04: Binary relationship with cardinality ratio 1:1


02/08/20 DBMS Unit-1 101
25
RULE-05 (contd..)

Case-01: For Binary Relationship With Cardinality Ratio m:n

• Here, three tables will be required-


1. A ( a1 , a2 )
2. R ( a1 , b1 )
3. B ( b1 , b2 )

02/08/20 DBMS Unit-1 102


25
RULE-05 (contd..)

Case-02: For Binary Relationship With Cardinality Ratio 1:n

• Here, two tables will be required-


1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )

NOTE- Here, combined table will


be drawn for the entity set B
and
relationship set R.
02/08/20 DBMS Unit-1 103
25
RULE-05 (contd..)

Case-03: For Binary Relationship With Cardinality Ratio m:1

• Here, two tables will be required-


1. AR ( a1 , a2 , b1 )
2. B ( b1 , b2 )

NOTE- Here, combined table will be drawn for the entity set A and
relationship set R.

02/08/20 DBMS Unit-1 104


25
RULE-05 (contd..)
Case-04: For Binary Relationship With Cardinality Ratio 1:1

• Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’

• Way-01:
1. AR ( a1 , a2 , b1 )
2. B ( b1 , b2 )
• Way-02:
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
02/08/20 DBMS Unit-1 105
25
RULE-06

Rule-06: For Binary Relationship With Both Cardinality Constraints


and Participation Constraints-

• Case-01: For Binary Relationship With Cardinality Constraint


and Total Participation Constraint From One Side

• Case-02: For Binary Relationship With Cardinality Constraint


and Total Participation Constraint From Both Sides-

02/08/20 DBMS Unit-1 106


25
RULE-06 (contd..)
Case-01: For Binary Relationship With Cardinality Constraint
and Total Participation Constraint From One Side

• Because cardinality ratio = 1 : n , so we will combine the entity set B


and relationship set R.
• Then, two tables will be required-
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
• Because of total participation, foreign key a1 has acquired
NOT
NULL constraint, so it can’t be null now.DBMS
02/08/20 Unit-1 107
25
RULE-06 (contd..)

Case-02: For Binary Relationship With Cardinality Constraint and


Total Participation Constraint From Both Sides
• If there is a key constraint from both the sides of an entity set with
total participation, then that binary relationship is represented
using only single table.

• Here, Only one table is required.


1. ARB ( a1 , a2 , b1 , b2 )

02/08/20 DBMS Unit-1 108


25
RULE-07

Rule-07: For Binary Relationship With Weak Entity Set


• Weak entity set always appears in association with
identifying relationship with total participation constraint.

• Here, two tables will be required-


1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )

02/08/20 DBMS Unit-1 109


25
Extended ER Model

Enhanced ERD are high level models that represent the requirements and
complexities of complex database.

In addition to ER model concepts EE-R includes −


 Subclasses and Super classes.
 Specialization and Generalization.
 Category or union type.
 Aggregation.

02/08/20 DBMS Unit-1 110


25
Extended ER Model

Subclasses and Super Class

02/08/20 DBMS Unit-1 111


25
Extended ER Model

Specialization and Generalization

02/08/20 DBMS Unit-1 112


25
Extended ER Model

Category or Union
Relationship of one super or sub class with more than one super class.

02/08/20 DBMS Unit-1 113


25
Extended ER Model

Aggregation
Represents relationship between a whole object and its component.

02/08/20 DBMS Unit-1 114


25
Relationship of higher degree

Degree of Relationship
A degree of relationship represents the number of entity types
that are associated with a relationship.
Types of degree
based on the number of linked entity types, we have 4 types of
degrees of relationships.
 Unary
 Binary
 Ternary
 N-ary

02/08/20 DBMS Unit-1 115


25
Relationship of higher degree

Unary (Degree 1)
in a relation only one entity set is participating then such type of
relationship is known as a unary relationship.
Example: In a particular class, we have many students, there are monitors
too. So, here class monitors are also students. Thus, we can say that only
students are participating here. So the degree of such type of relationship
is 1.

02/08/2025 DBMS Unit-1 116


Relationship of higher degree

Binary (Degree 2)
In a relation when two entity sets are participating then such type
of relationship is known as a binary relationship. This is the most used
relationship and one can easily be converted into a relational table.

Example: We have two entity types ‘Student’ and ‘ID’ where each
‘Student’ has his ‘ID’. So, here two entity types are associating, it is a binary
relationship.
Also, one ‘Father’ can have many ‘daughters’ but each ‘daughter’ should
belong to only one ‘father. it is a one-to-many binary relationship.

02/08/2025 DBMS Unit-1 117


Relationship of higher degree

Ternary (Degree 3)
Ternary relationship exists when there are three types of entity
and we call them a degree of relationship is 3.

Example: We have three entity types ‘Teacher’, ‘Course’, and ‘Class’. The
relationship between these entities is defined as the teacher teaching a
particular course, also the teacher teaches a particular class. So, here three
entity types are associating we can say it is a ternary relationship.

02/08/2025 DBMS Unit-1 118


Relationship of higher degree

N-ary (n Degree)
an N-ary relationship exists when there are n types of entities.
There is one limitation of the N-ary relationship, as there are many entities
so it is very hard to convert into an entity, rational table.
https://youtu.be/M4qZ5i1LL2o?si=M-YvPZ1Vp9KZK5Kn
https://youtu.be/010_f2HKzJY?si=82Z1Qleud-bBduii
Example: We have 5 entities Teacher, Class, Location, Salary, Course. So,
here five entity types are associating we can say an n-ary relationship is 5.

02/08/2025 DBMS Unit-1 119


Extended Entity-Relationship (EER) Model

The EER model extends the ER model to include more complex


features.
1. Specialization and Generalization:
• Generalization: Combining two or more entities into a higher-level
entity.
• Example: "Car" and "Truck" become "Vehicle.“
• Specialization: Dividing a higher-level entity into sub-entities.
• Example: "Employee" becomes "Manager" and "Engineer.“
2. Attributes on Relationships:
• EER allows attributes to be associated directly with relationships.
3. Categories (Union Types):
• An entity that represents a collection of entities from different
types.

02/08/20 DBMS 12
25 0
Generalization
• Generalization is the process of extracting common properties from
a set of entities and create 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.

• For Example, STUDENT and FACULTY can be generalized to a higher


level entity called PERSON as shown in Figure.

• In this case, common attributes like P_NAME, P_ADD become part


of higher entity (PERSON) and specialized attributes like S_FEE
become part of specialized entity (STUDENT).

02/08/20 Sana Anjum DBMS Unit-1 121


25
Example:

02/08/20 DBMS Unit-1 122


25
Specialization

• In specialization, an entity is divided into sub-entities based on their


characteristics.

• It is a top-down approach where higher level entity is specialized


into two or more lower level entities.

• For Example, EMPLOYEE entity in an Employee management system


can be specialized into DEVELOPER, TESTER etc. as shown in Figure.

• In this case, common attributes like E_NAME, E_SAL etc. become


part of higher entity (EMPLOYEE) and specialized attributes like
TES_TYPE become part of specialized entity (TESTER).

02/08/20 DBMS Unit-1 123


25
Example:

02/08/20 DBMS Unit-1 124


25
Aggregation
• An ER diagram is not capable of representing relationship between
an entity and a relationship which may be required in some
scenarios.
• In those cases, a relationship with its corresponding entities is
aggregated into a higher level entity.
• Aggregation is an abstraction through which we can represent
relationships as higher level entity sets.
• For Example, Employee working for a project may require some
machinery. So, REQUIRE relationship is needed between
relationship WORKS_FOR and entity MACHINERY. Using
aggregation, WORKS_FOR relationship with its entities EMPLOYEE
and PROJECT is aggregated into single entity and relationship
REQUIRE is created between aggregated entity and MACHINERY.

02/08/20 DBMS Unit-1 125


25
Example:

02/08/20 DBMS Unit-1 126


25
Short Quiz

Q. Given the basic ER and relational models, which of the following is


INCORRECT?
answer choices
1. An attribute of an entity can have more than one value.
2. An attribute of an entity can be composite.
3. In a row of a relational table, an attribute can have more than
one value.
4. In a row of a relational table, an attribute can have exactly one
value
or a NULL value.

Q. Which type of entity cannot exist in the database unless another type
of entity also exists in the database, but does not require that the
identifier of that other entity be included as part of its own
identifier?

5. Weak entity
6. Strong entity
7. ID-dependent entity
02/08/20 DBMS Unit -1 127
25 8. ID- independent entity
Topic- Database Language Objective

1. DDL stands for Data Definition Language. DML stands for Data
Manipulation Language. DDL statements are used to create database,
schema, constraints, users, tables etc. DML statement is used to insert,
update or delete the records.

2. DCL (Data Control Language) includes commands like GRANT


and
REVOKE, which are useful to give “rights & permissions.”

3. Transaction control language or TCL commands deal with the


transaction within the database.

4. Data Query Language (DQL) is used to fetch the data from the database.

02/08/20 DBMS Unit-1 12


25 8
DATA BASE LANGUAGE

• 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.
• Two classes of languages
– Procedural – user specifies what data is required and how to get
– those data
Declarative (nonprocedural) – what data is
user specifies required without specifying how
to get those data
• SQL is the most widely used query language

02/08/20 DBMS 12
25 9
DATA BASE
LANGUAGE

02/08/20 DBMS 13
25 0
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.

02/08/20 Sana Anju DBMS 13


25 1
Data Definition Language
(DDL)
• 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.

02/08/20 DBMS 13
25 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.

02/08/20 DBMS 13
25 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.

02/08/20 DBMS 13
25 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.

02/08/20 DBMS 13
25 5
Short Quiz

1. The ability to query data, as well as insert, delete, and alter tuples,
is
offered by
a) TCL (Transaction Control Language)
b) DCL (Data Control Language)
c) DDL (Data Definition Langauge)
d) DML (Data Manipulation Langauge)

2. Which command is used to remove a relation from an SQL?


a) Drop table
b) Delete
c) Purge
d) Remove

02/08/20 DBMS 13
25 6
Topic- Relational Model and SQL Objective

1. The purpose of the relational model is to provide a declarative method


for specifying data and queries: users directly state what information
the database contains and what information they want from it.

2. One of the major goals of Object relational data model is to close the
gap between relational databases and the object oriented practises
frequently used in many programming languages such as C++, C#, Java
etc.

3. Be able to write SQL statements that edit existing data. Be able to write
SQL statements that create database objects.

4. Understand the structure and design of relational databases.


Understand the importance and major issues of database security and
the maintenance of data integrity.

8/24/2022
02/08/20 DBMS 53
13
25 7
Relational
Model

• Example of tabular data in the relational model


Attributes

02/08/20 DBMS 13
25 8
A Sample Relational Database

02/08/20 DBMS 13
25 9
Properties of Relations

• Name of the relation is distinct from all other relations.


• Each value in a tuple is an atomic value; that is, it is not divisible into components
within the framework of the basic relational model. Hence, composite and multivalued
attributes are not allowed. This model is sometimes called the flat relational model.
Hence, multivalued attributes must be represented by separate relations, and
composite attributes are represented only by their simple component attributes in the
basic relational model.
• Each attribute contains a distinct name.
• Attribute domain has no significance.
• Tuple has no duplicate value.
• Order of tuple can have a different sequence.

02/08/2025 140
Constraints in Relational Model
• An important concept is that of NULL values, which are used to represent the values of
attributes that may be unknown or may not apply to a tuple. A special value, called NULL, is
used in these cases.

Constraints In Relational Model:


• While designing Relational Model, we define some conditions which must hold for data
present in database are called Constraints.
• These constraints are checked before performing any operation (insertion, deletion and
updation) in database.
• If there is a violation in any of constrains, operation will fail.

02/08/2025 141
Types of Integrity Constraints

02/08/2025 142
Domain constraints

• Domain constraints can be defined as the definition of a valid set of values for an
attribute.
• The data type of domain includes string, character, integer, time, date, currency,
etc. The value of the attribute must be available in the corresponding domain.

02/08/2025 143
Entity integrity constraints

• The entity integrity constraint states that primary key value can't be null.
• This is because the primary key value is used to identify individual rows in
relation and if the primary key has a null value, then we can't identify those rows.
• A table can contain a null value other than the primary key field.

02/08/2025 144
Referential Integrity Constraints

• A referential integrity constraint is specified between two tables.


• In the Referential integrity constraints, if a foreign key in Table 1 refers to the
Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be null
or be available in Table 2.

02/08/2025 145
Key constraints

• Keys are the entity set that is used to identify an entity within its entity set uniquely.
• An entity set can have multiple keys, but out of which one key will be the primary
key. A primary key can contain a unique and null value in the relational table.

02/08/2025 146
Contents

Relational Algebra

Basic of Relational Database


Relational Algebra
Importance of Relational Algebra
Relational Query Language and their types
Relational Algebra Operations

02/08/2025 147
Basic of Relational Database

Once we have database ready users will start using them.


But how will they access the database? Most of the time they access the data by using
some applications.
 These applications will communicate to database by SQL and DBMS is responsible
for managing the application and SQL intact.
SQL has its own querying methods to interact with database. But how these queries
work in the database?
These queries work similar to relational algebra that we have in mathematics.

Note :- Relational algebra mainly provides theoretical foundation for relational


databases and SQL.

02/08/2025 148
Relational Algebra

The basic set of operations for the relational model is known as the relational
algebra. These operations enable a user to specify basic retrieval requests.
Working of relational Algebra
The result of a retrieval is a new relation, which may have been formed from one or
more relations. The algebra operations thus produce new relations, which can be
further manipulated using operations of the same algebra.
A sequence of relational algebra operations forms a relational algebra expression,
whose result will also be a relation that represents the result of a database query (or
retrieval request).

02/08/2025 149
Importance of Relational Algebra

Importance of relational Algebra


1. It provides a formal foundation for relational model operations.
2. It is used as a basis for implementing and optimizing queries in the query
processing and optimization modules that are integral parts of relational database
management systems (RDBMSs)
3. Some of its concepts are incorporated into the SQL . The Relational Algebra and
Relational Calculus query language for RDBMSs.
Although most commercial RDBMSs in use today do not provide user interfaces for
relational algebra queries, the core operations and functions in the internal modules
of most relational systems are based on relational algebra operations.

02/08/2025 150
Query Processing

02/08/2025 151
Relational Query Languages

• Relational query languages use relational algebra to break the user requests and
instruct the DBMS to execute the requests. It is the language by which user
communicates with the database.

These relational query languages can be:

1. Procedural Query Language


2. Non- Procedural Query Language

02/08/2025 152
Relational Query Languages(Conti…)

1. Procedural Query Language


In procedural query language, user instructs the system to perform a series of
operations to produce the desired results.

Here users tells what data to be retrieved from database and how to retrieve it.
Relational algebra is a procedural query language.

02/08/2025 153
Relational Query Languages(conti…)

2. Non- Procedural Query Language


In Non-procedural query language, user instructs the system to produce the desired
result without telling the step by step process. Here users tells what data to be
retrieved from database but doesn’t tell how to retrieve it.
Relational Calculus is Non- Procedural Query Language.
Example :-
If you are just telling him to make a tea and not telling the process then it is a non-
procedural language, however if you are telling the step by step process like switch
on the stove, boil the water, add milk etc. then it is a procedural language.

02/08/2025 154
Relational Query Languages(conti…)

Note :- I have used word conceptual while describing relational algebra and
relational calculus, because they are theoretical mathematical system or
query language, they are not the practical implementation, SQL is a practical
implementation of relational algebra and relational calculus.

02/08/2025 155
Relational Algebra

• Relational algebra is a procedural query language.


• It gives a step by step process to obtain the result of the query.
• It takes Relation as input and generate relation as output. Relational algebra mainly
provides theoretical foundation for relational databases and SQL.
• It uses operators to perform queries. An operator can be either unary or binary.
• No duplication is allowed.

02/08/2025 156
Relational Algebra Operations

Basic/Fundamental Operator Derived operator


• SELECT(σ) • Intersection

• Projection(π) • Join Operations


• Inner Join:
• Rename (ρ) • Theta Join:

• NATURAL JOIN (⋈)


• Union operation (υ) • EQUI join:

• Set Difference (-)


• OUTER JOIN
• Cartesian product(X)
• Left Outer Join
• Right Outer Join
• Full Outer Join

02/08/2025 157
Basic SQL Relational Algebra Operations

Relational Algebra divided in various groups


• Unary Relational Operations
• SELECT (symbol: σ)
• PROJECT (symbol: π)
• RENAME (symbol: ρ)
• Relational Algebra Operations From Set Theory
• UNION (υ)
• INTERSECTION ( ),
• DIFFERENCE (-)
• CARTESIAN PRODUCT ( x )
• Binary Relational Operations
• JOIN
• DIVISION

02/08/2025 158
SELECT (σ)

• The SELECT operation is used for selecting a subset of the tuples according to a given
selection condition. Sigma(σ)Symbol denotes it. It is used as an expression to choose
tuples which meet the selection condition. Select operator selects tuples that satisfy a
given predicate.

Notation: σp(r)
where:
• σ is the predicate
• r stands for relation which is the name of the table
• p is prepositional logic

02/08/2025 159
SELECT (σ) Examples

• Example 1:
σ topic = "Database" (Subject)
Output – Selects tuples from Subject where topic = ‘Database’.
• Example 2
σ topic = "Database" and author = “Codd"( Subject)
Output – Selects tuples from Subject where the topic is ‘Database’ and
‘author’ is Codd.
• Example 3
σ sales > 50000 (Customers)
Output – Selects tuples from Customers where sales is greater than
50000

02/08/2025 160
Projection(π)

• The projection eliminates all attributes of the input relation but those
mentioned in the projection list. The projection method defines a relation
that contains a vertical subset of Relation.
• This helps to extract the values of specified attributes to eliminates
duplicate values. (pi) ∏ symbol is used to choose attributes from a relation.
This operator helps you to keep specific columns from a relation and
discards the other columns.
• Notation: ∏ A1, A2, An (r)
• A1, A2, A3 is used as an attribute name of relation r.

02/08/2025 161
Example of Projection

• Consider the following table


CustomerID CustomerName Status

1 Google Active

2 Amazon Active

3 Apple Inactive

4 Alibaba Active

• Here, the projection of CustomerName and status will give


• Π CustomerName, Status (Customers)

CustomerName Status

Google Active

Amazon Active

Apple Inactive

Alibaba Active

02/08/2025 162
Rename (ρ)

• Rename is a unary operation used for renaming attributes of a relation.

• ‘Rename' operation is denoted with small Greek letter rho ρ.

• ρ (a/b)R will rename the attribute ‘b’ of relation by ‘a’.

02/08/2025 163
Union operation (υ)

•UNION is symbolized by ∪ symbol. It includes all tuples that are either in R or S or


both in R & S.It also eliminates duplicate tuples. So, set A UNION set B would be
expressed as:
A ∪ B.
•For a union operation to be valid, the following conditions must hold :
• R and S must be the same number of attributes.
• Attribute domains need to be compatible.
• Duplicate tuples should be automatically removed.

02/08/2025 164
Example of Union

• Consider the following tables.


Table A Table B
column 1 column 2 column 1 column 2

1 1 1 1

1 2 1 3

• A ∪ B gives
column 1 column 2

1 1

1 2

1 3

02/08/2025 165
Set Difference (-)

• The result of set difference operation is tuples, which are present in one relation
but are not in the second relation. – Symbol denotes it.
• The result of A – B, is a relation which includes all tuples that are in A but not in
B.

Notation : r − s

• Finds all the tuples that are present in r but not in s.


• The attribute name of A has to match with the attribute name in B.
• The two-operand relations A and B should be either compatible or Union
compatible.
• It should be defined relation consisting of the tuples that are in relation A, but not
in B.

02/08/2025 166
Set Difference (-) Example

Table A Table B

column 1 column 2 column 1 column 2

1 1 1 1

1 2 1 3

• Example: A-B

Table A – B

column 1 column 2

1 2

02/08/2025 167
Intersection

• An intersection is defined by the symbol ∩


Notation : A ∩ B
• Defines a relation consisting of a set of all tuple that are in both A
and B. However, A and B must be union-compatible.

02/08/2025 168
Intersection Example

Table A Table B
column 1 column 2 column 1 column 2

1 1 1 1

1 2 1 3

• Example: A ∩ B

Table A ∩ B
column 1 column 2

1 1

02/08/2025 169
Cartesian Product(X) in DBMS

•Cartesian Product in DBMS is an operation used to merge columns from two relations.
Generally, a cartesian product is never a meaningful operation when it performs alone.
However, it becomes meaningful when it is followed by other operations. It is also
called Cross Product or Cross Join.

• σ column 2 = ‘1’ (A X B)
• Output – The above example shows all rows from relation A and B whose column 2
has value 1

σ column 2 = ‘1’ (A X B)

column 1 column 2

1 1

1 1

02/08/2025 170
Cartesian Product(X) Example

• Consider R1 table −
RegNo Branch Section
1 CSE A
2 ECE B
3 CIVIL A
4 IT B

• Table R2
Name RegNo

Bhanu 2

Priya 4

02/08/2025 171
Cartesian Product(X) Example

• R1 X R2

RegNo Branch Section Name RegNo

1 CSE A Bhanu 2

1 CSE A Priya 4

2 ECE B Bhanu 2

2 ECE B Priya 4

3 CIVIL A Bhanu 2

3 CIVIL A Priya 4

4 IT B Bhanu 2

4 IT B Priya 4

Sana Anjum DBMS ACE0506 Unit-2

02/08/2025 172
Join Operations

• Join operation is essentially a cartesian product followed by a selection criterion.


• Join operation denoted by ⋈.
• JOIN operation also allows joining variously related tuples from different relations.
Types of JOIN: Various forms of join operation are:
• Inner Joins:
• Theta join
• EQUI join
• Natural join
• Outer join:
• Left Outer Join
• Right Outer Join
• Full Outer Join

02/08/2025 173
Join Operations

• Various forms of join operation


• JOIN (Inner Join) : Return rows when there is at least one match in both tables
• LEFT JOIN(Left Outer Join): Return all rows from the left table, even if there are
no matches in the right table
• RIGHT JOIN(Right Outer Join): Return all rows from the right table, even if there
are no matches in the left table
• FULL JOIN: Return rows when there is a match in one of the tables

Sana Anjum DBMS ACE0506 Unit-2

02/08/2025 174
Inner Join (Theta Join)

• In an inner join, only those tuples that satisfy the matching criteria are included, while
the rest are excluded. Let’s study various types of Inner Joins:
Theta Join:
• The general case of JOIN operation is called a Theta join. It is denoted by symbol θ
Example:- A ⋈θ B
• Theta join can use any conditions in the selection criteria.
• For example:- A ⋈ A.column 2 > B.column 2 (B)

A ⋈ A.column 2 > B.column 2 (B)

column 1 column 2

1 2

02/08/2025 175
Inner Join ( Equi Join)

EQUI join:
• When a theta join uses only equivalence condition, it becomes a equi join.

• For example:- A ⋈ A.column 2 = B.column 2 (B)

A ⋈ A.column 2 = B.column 2 (B)

column 1 column 2

1 1

02/08/2025 176
Inner Join- Natural Join (⋈)

NATURAL JOIN:
Natural Join does not utilize any of the comparison operators. In this type of join, the
attributes should have the same name and domain.

• In Natural Join, there should be at least one common attribute between two
relations.

• It performs selection forming equality on those attributes which appear in both


relations and eliminates the duplicate attributes.

02/08/2025 177
Natural Join Example

• Consider the following two tables


C D

Num Square Num Cube

2 4 2 8

3 9 3 27

• C⋈D
C⋈D

Num Square Cube

2 4 8

3 9 27

02/08/2025 178
Outer Join

Outer Join:
•An OUTER JOIN doesn’t require each record in the two join tables to have a
matching record. In this type of join, the table retains each record even if no other
matching record exists.
Three types of Outer Joins are:
• Left Outer Join
• Right Outer Join
• Full Outer Join

02/08/2025 179
Left Outer Join (A B)

LEFT outer Join:


• LEFT JOIN returns all the rows from the table on the left even if no matching
rows have been found in the table on the right. When no matching record found in
the table on the right, NULL is returned.

02/08/2025 180
Left Outer Join Example

• Consider the following 2 Tables


A

Num Square

2 4

3 9

4 16

Num Cube

2 8

3 27

5 125

02/08/2025 181
Left Outer Join Example

• (A B)

(A B)
Num Square Cube

2 4 8

3 9 27

4 16 –

02/08/2025 182
Right Outer Join (A B)

Right outer join:


• RIGHT JOIN returns all the columns from the table on the right even if no
matching rows have been found in the table on the left. Where no matches
have been found in the table on the left, NULL is returned. RIGHT outer JOIN
is the opposite of LEFT JOIN

02/08/2025 183
Right Outer Join Example

(A B)

(A B)

Num Cube Square

2 8 4

3 27 9

5 125 –

02/08/2025 184
Full Outer Join (A B)

• In a FULL OUTER JOIN , all tuples from both relations are included in the result,
irrespective of the matching condition.

• Example:

A B

Num Square Cube

2 4 8

3 9 27

4 16 –

5 – 125

02/08/2025 185
Relational Algebra Queries

Ques: Let us consider following relational database consisting of four relation schemas :
passenger ( pid, pname, pgender, pcity)
agency ( aid, aname, acity)
flight (fid, fdate, time, src, dest)
booking (pid, aid, fid, fdate)
Write the relational algebra queries for the following expression
1. Get all details of flights scheduled on both dates 01/12/2022 and 02/12/2022 at
16:00.
2. Find the passenger names for passengers who have bookings on at least one flight.
3. Find the pid of passenger who booking every flight.
4. Find the name and city of passenger whose gender is female .
5. Find the name of passenger who booking the flight by ‘MakeMyTrip’ agency.
6. Get the complete details of all flights to New Delhi.

02/08/2025 186
Short Quiz

1. After groups have been established, SQL applies predicates in the


clause, allowing aggregate functions to be
used.
a) Where
b) Having
c) Group by
d) With

2. Why the following statement is erroneous?

SELECT dept_name, ID, avg (salary) FROM instructor GROUP BY


dept_name;

a) Dept_id should not be used in group by clause


b) Group by clause is not valid in this query
c) Avg(salary) should not be selected
d) None
02/08/20 DBMS 18
25 7
Use Cases Videos

https://youtu.be/M4qZ5i1LL2o?si=M-YvPZ1Vp9KZK5Kn

https://youtu.be/010_f2HKzJY?si=82Z1Qleud-bBduii

02/08/2025 DBMS Unit-1 188


Topic Links

1. https://www.geeksforgeeks.org/last-minute-notes-dbms/
2. https://www.geeksforgeeks.org/quiz-corner-gq/#DBMS%20Mock%20Tests
3. https://www.geeksforgeeks.org/commonly-asked-dbms-interview-
questions/
4. https://www.geeksforgeeks.org/commonly-asked-dbms-interview-
questions-set-2/

02/08/20 DBMS Unit-1 189


25
Daily Quiz

• Define Database System.


• What do you understand by data independence?
• Explain types of attributes in ER diagram.
• What is generalization.
• What do you understand by primary key?
• Explain participation cardinality.
• Differentiate between primary key and candidate key.

02/08/20 DBMS Unit-1 190


25
MCQ s

• The entity relationship set is represented in E-R diagram as


a) Double diamonds
b) Undivided rectangles
c) Dashed lines
d) Diamond

• The Rectangles divided into two parts represents


a) Entity set
b) Relationship set
c) Attributes of a relationship set
d) Primary key

02/08/20 DBMS Unit-1 191


25
MCQ s

• An entity set that does not have sufficient attributes to form a


primary key is termed a __
a) Strong entity set
b) Variant set
c) Weak entity set
d) Variable set

• What term is used to refer to a specific record in your music


database; for instance; information stored about a specific album?
a) Relation
b) Instance
c) Table
d) Column

02/08/20 DBMS Unit-1 192


25
Glossary Questions

1. What are the features of Database language?


2. What is Data Independence in a database system?
3. Define database model.
4. What is SQL?
5. Enlist the various relationships of database.
6. Define DDL and DML.
7. Enlist some commands of DDL.
8. What are the key concepts of the Entity-Relationship (ER)
Model in data modelling?

02/08/20 DBMS Unit-1 193


25
Weekly Assignment

• Define: Data, Database, and Database System.


• What is data independence? What are differences between Logical
Data Independence and Physical Data Independence?
• Give example of Simple, Composite, Single –valued and Multi-
valued attributes of an entity.
• What is the difference between Generalization & Specialization
with respect to Database?
• What is difference between total and partial participation? Explain
by suitable example.
• Construct an E-R diagram for a hospital with a set of patients and a
set of medical doctors. Associated with each patient, a log of the
various tests and examinations conducted.

02/08/20 DBMS Unit-1 194


25
Old Question
Papers
• http://www.aktuonline.com/papers/btech-cs-5-sem-data-base-
management-system-KCS501-2020.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-
management-system-KCS-501-2018-19.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-
management-system-ncs-502-2017-18.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-
management-system-ncs-502-2016-17.pdf

02/08/20 DBMS Unit-1 195


25
Expected Questions for University Exam

• Explain types of attributes in ER diagram.


• Explain the difference between a weak and a strong entity set with
example.
• Discuss three level of abstractions schemas architecture
or DBMS. of
• Define constraint and its types in DBMS.
• Compare Generalization,
Specialization and
suitable examples.
• aggregation with
Draw overall structure of DBMS and explain its components in brief.
• Construct an E-R diagram for a hospital with a set of patients and a
set of medical doctors. Associated with each patient, a log of the
various tests and examinations conducted.

02/08/20 DBMS Unit-1 196


25
Recap of Unit

• Knowledge of database architecture.

• Knowledge of Entity Relationship model and its


concepts.

• Databse V/S File system.

02/08/20 DBMS Unit-1 197


25
THANK YOU

02/08/20 DBMS Unit-1 198


25

You might also like