SlideShare a Scribd company logo
UNIT II
INTRODUCTION TO RDBMS
Relational Algebra in RDBMS
Relational Algebra is a procedural query language that provides
a formal foundation for retrieving and manipulating data stored in
relational databases. It uses operators to perform queries,
combining one or more relations (tables) to produce a new
relation as a result.
Fundamental operators used in Relational
Algebra
 Selection(σ)
 Projection(π)
 Union(U)
 Set Difference(-)
 Set Intersection(∩)
 Rename(ρ)
 Cartesian Product(X)
Selection (σ)
Projection (π)
Union ( )
∪
Set Difference ( − )
Cartesian Product ( × )
Rename (ρ)
Relational Algebra Query Examples
Relational Algebra Query Examples
Relational Algebra Query Examples
Relational Calculus in RDBMS
Relational Calculus is a non-procedural query language that specifies
what data to retrieve rather than how to retrieve it. It is based on
predicate logic and focuses on describing the conditions for the desired
result.
There are two main types of relational calculus:
1.Tuple Relational Calculus (TRC)
2.Domain Relational Calculus (DRC)
Differences Between Relational
Algebra and Calculus
Aspect Relational Algebra Relational Calculus
Type
Procedural: Specifies steps to retrieve
data.
Declarative: Specifies what data
to retrieve.
Basis Based on algebraic operations. Based on predicate logic.
Ease of Use
Requires knowledge of operations
and execution.
More intuitive and easier for users.
Focus Focuses on how to retrieve data. Focuses on what data to retrieve.
Tuple Relational Calculus (TRC)
Definition: Queries are expressed using tuple variables, which represent
rows (tuples) in a relation.
Syntax
t: A tuple variable.
P(t): A predicate that specifies the condition(s) the tuple ttt must satisfy.
Example:
Retrieve names of employees earning more than $50,000:
Components of TRC
 Tuple Variables: Represent rows in a relation.
 Predicates: Conditions involving attributes of tuples, constants, and logical
operators ( , ,¬).
∧ ∨
Quantifiers:
 Universal Quantifier ( )
∀ : States that a condition holds for all tuples.
 Existential Quantifier ( )
∃ : States that there exists at least one tuple satisfying
the condition.
Domain Relational Calculus (DRC)
Definition: Queries are expressed using domain variables, which represent individual
attributes (columns) rather than entire tuples.
Syntax:
Example:
Retrieve names of employees earning more than $50,000:
Differences Between TRC and DRC
Aspect Tuple Relational Calculus (TRC) Domain Relational Calculus (DRC)
Variables
Uses tuple variables (representing
rows).
Uses domain variables (representing
columns).
Focus Focuses on tuples (rows). Focuses on attributes (columns).
Syntax ( { t P(t) } )
Complexity Easier for tuple-based conditions. Suitable for attribute-level queries.
Codd's rules
 Dr. Edgar F. Codd proposed Codd's 12 rules (or 13 including Rule 0) as
a guideline for relational database systems.
 These rules are intended to define what constitutes a true relational
database system and ensure its adherence to relational principles.
Rule 0: The Foundation Rule
A system qualifies as a relational database management system (RDBMS)
if it fully supports the relational model.
Rule 1: The Information Rule
All data should be stored in tables (relations), and all data is accessible
through table column values.
Rule 2: Guaranteed Access Rule
Each data item (value) in a database must be accessible using a
combination of a table name, primary key, and column name.
Rule 3: Systematic Treatment of Null Values
The database must allow null values to represent missing, unknown, or
inapplicable information.
Rule 4: Active Online Catalog Rule
The database catalog, which contains metadata about the
database, must be stored and accessed using the same relational
database management system.
Rule 5: The Comprehensive Data Sublanguage Rule
A crucial component of any efficient database system is its ability
to offer an easily understandable data manipulation language (DML) that
facilitates defining, querying, and modifying information within the
database.
Rule 6: The View Updating Rule
All views that are theoretically updatable must also be updatable
by the system.
Rule 8: Physical Data Independence
Application programs and activities should remain unaffected
when changes are made to the physical storage structures or methods.
Rule 7: High-level Insert, Update, and Delete
A successful database system must possess the feature of
facilitating high-level insertions, updates, and deletions that can grant users
the ability to conduct these operations with ease through a single query.
Rule 9: Logical Data Independence
Application programs and activities should remain unaffected
when changes are made to the logical structure of the data, such as
adding or modifying tables.
Rule 10: Integrity Independence
Integrity constraints should be specified separately from application
programs and stored in the catalog. They should be automatically enforced
by the database system.
Rule 11: Distribution Independence
The distribution of data across multiple locations should be invisible
to users, and the database system should handle the distribution
transparently.
Rule 12: Non-Subversion Rule
If the interface of the system is providing access to low-level records,
then the interface must not be able to damage the system and bypass security
and integrity constraints.
Functional Dependencies
• Functional Dependency (FD) is a constraint that describes
the relationship between attributes in the relation (table).
• FDs and Keys are used to define the normal forms for
relations.
Functional Dependencies
Definition :
Relation schema: R {A1,A2,...,An}
X , Y are subsets of R
If R: X Y then,
If t1[X]=t2[X] then,
t1[Y]=t2[Y] in any relation instance r(R)
R
t2
t1
Y
X
Examples for FD constraints.
Examples for FD constraints.
• Student ID determines Student name and Birth date.
StID  {StName, Bdate}
• Sport Name determines type of sport.
SpName  type
• Student ID and Sport Name determine the hours per week that
the student practices his sport.
{StID, SpName}  hours
Functional Dependencies
• A FD is a property of attributes in the relational schema R
(intension).
• If L is a key of the relation R, it determines all the attributes of
R.
Inference Rules for FDs.
• Armstrong's inference rules
A1. (Reflexive) If Y subset-of X, then X  Y
A2. (Augmentation) If X  Y, then XZ  YZ
(Notation: XZ stands for X U Z)
A3. (Transitive) If X  Y and Y  Z, then X  Z
Additional Useful Inference Rules.
• Decomposition
If X  YZ, then X  Y and X  Z
• Union
If X  Y and X  Z, then X  YZ
• Psuedotransitivity
If X  Y and WY  Z, then WX  Z
Types of Functional Dependencies.
1. Trivial Functional Dependency.
2. Non-Trivial Functional Dependency.
3. Multi-valued Dependency.
4. Transitivity Dependency.
1. Trivial Functional Dependency.
• The dependency of an attribute on a set of attributes is known
as trivial functional dependency if the set of attributes includes
that attribute.
If B is a subset of A then,
ABB
AA
BB
A B
2. Non-Trivial Functional Dependency.
• If a functional dependency X->Y holds true where Y is not a
subset of X
If B is not a subset of A then,
AB
A B
3. Multi-valued Dependency.
• If there are more than one independent multi-valued attributes
in a relation, that is called “multi-valued dependency”.
bike_model manf_year colour
V001 2011 Black
V001 2011 Blue
V002 2012 Black
V002 2012 Blue
V003 2013 Black
V003 2013 Blue
bike_model ->> manf_year
bike_model ->> colour
4. Transitivity Dependency.
• A functional dependency is said to be transitive if it is indirectly
formed by two functional dependencies.
Transitive dependency: XZ;
if the following three functional dependencies hold TRUE,
XY
Y does not X
YZ
• Can only occur in a relation of three or more attributes.
• Helps to normalizing the DB in 3NF.
Example_Transitivity Dependency.
Book Author Author_Age
ABC Nimal Bandara 48
XY Sakunthala Weerasinghe 36
MNO Nimal Bandara 48
{Book}  {Author}
{Author} does not  {Book}
{Book} { Author_Age}
Therefore Transitive Dependency is;
{Book}  {Author_Age} ;
Normalization
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
Introduction to database management system
De-Normalization
Introduction to database management system

More Related Content

Similar to Introduction to database management system (20)

PPTX
DATABASE THOERY and practice o data.pptx
makohaalex22
 
PPT
basic concepts of Entity relationship diagram
geta41
 
PPTX
Dbms ppt
Surkhab Shelly
 
PPTX
Normalization
Dabbal Singh Mahara
 
PPTX
Dbms
RinkuNahar
 
PPT
Database normalization
VARSHAKUMARI49
 
PPTX
data dependency in relational database management
ssuserf80a8c
 
PDF
[Www.pkbulk.blogspot.com]dbms09
AnusAhmad
 
PDF
Dbms unit-3
MUKESH KUMAR
 
PPTX
Fd & Normalization - Database Management System
Drishti Bhalla
 
PPTX
Unit 3 dbms
Sweta Singh
 
PDF
Normalization.pdf
abhijose1
 
PDF
DBMS 3.pdf
NithishReddy90
 
PPTX
Relational Database Design Functional Dependency – definition, trivial and no...
VishwanathJustRockin
 
PPTX
functional dependency in database (1).pptx
sunaina3086
 
PDF
DBMS Part-4.pdf
Prof. Dr. K. Adisesha
 
PPTX
Normalization.pptx Functional dependence
sadiariasat10
 
PPTX
Functional dependency.pptx
ssuser7e9b941
 
PPT
DBMS unit 3.ppt semester 4 btech aktu 2024
Nancy424661
 
DATABASE THOERY and practice o data.pptx
makohaalex22
 
basic concepts of Entity relationship diagram
geta41
 
Dbms ppt
Surkhab Shelly
 
Normalization
Dabbal Singh Mahara
 
Database normalization
VARSHAKUMARI49
 
data dependency in relational database management
ssuserf80a8c
 
[Www.pkbulk.blogspot.com]dbms09
AnusAhmad
 
Dbms unit-3
MUKESH KUMAR
 
Fd & Normalization - Database Management System
Drishti Bhalla
 
Unit 3 dbms
Sweta Singh
 
Normalization.pdf
abhijose1
 
DBMS 3.pdf
NithishReddy90
 
Relational Database Design Functional Dependency – definition, trivial and no...
VishwanathJustRockin
 
functional dependency in database (1).pptx
sunaina3086
 
DBMS Part-4.pdf
Prof. Dr. K. Adisesha
 
Normalization.pptx Functional dependence
sadiariasat10
 
Functional dependency.pptx
ssuser7e9b941
 
DBMS unit 3.ppt semester 4 btech aktu 2024
Nancy424661
 

More from backiyalakshmi14 (9)

PPTX
Normalization in Relational database management systems
backiyalakshmi14
 
PPT
Memory Management techniques in operating systems
backiyalakshmi14
 
PPTX
Jquery in web development, including Jquery in HTML
backiyalakshmi14
 
PPTX
sequential circuits, flip flops and Latches
backiyalakshmi14
 
PPTX
Flipflop & Latches, RS Flipflop, NOR and NAND Gate Circuits
backiyalakshmi14
 
PPTX
Half adders and full adders in digital principles
backiyalakshmi14
 
PPTX
Basic gates in electronics and digital Principles
backiyalakshmi14
 
PPTX
Introduction to java script, how to include java in HTML
backiyalakshmi14
 
PPTX
HUMAN VALUES DEVELOPMENT for skill development
backiyalakshmi14
 
Normalization in Relational database management systems
backiyalakshmi14
 
Memory Management techniques in operating systems
backiyalakshmi14
 
Jquery in web development, including Jquery in HTML
backiyalakshmi14
 
sequential circuits, flip flops and Latches
backiyalakshmi14
 
Flipflop & Latches, RS Flipflop, NOR and NAND Gate Circuits
backiyalakshmi14
 
Half adders and full adders in digital principles
backiyalakshmi14
 
Basic gates in electronics and digital Principles
backiyalakshmi14
 
Introduction to java script, how to include java in HTML
backiyalakshmi14
 
HUMAN VALUES DEVELOPMENT for skill development
backiyalakshmi14
 
Ad

Recently uploaded (20)

PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
community health nursing question paper 2.pdf
Prince kumar
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
Ad

Introduction to database management system

  • 2. Relational Algebra in RDBMS Relational Algebra is a procedural query language that provides a formal foundation for retrieving and manipulating data stored in relational databases. It uses operators to perform queries, combining one or more relations (tables) to produce a new relation as a result.
  • 3. Fundamental operators used in Relational Algebra  Selection(σ)  Projection(π)  Union(U)  Set Difference(-)  Set Intersection(∩)  Rename(ρ)  Cartesian Product(X)
  • 13. Relational Calculus in RDBMS Relational Calculus is a non-procedural query language that specifies what data to retrieve rather than how to retrieve it. It is based on predicate logic and focuses on describing the conditions for the desired result. There are two main types of relational calculus: 1.Tuple Relational Calculus (TRC) 2.Domain Relational Calculus (DRC)
  • 14. Differences Between Relational Algebra and Calculus Aspect Relational Algebra Relational Calculus Type Procedural: Specifies steps to retrieve data. Declarative: Specifies what data to retrieve. Basis Based on algebraic operations. Based on predicate logic. Ease of Use Requires knowledge of operations and execution. More intuitive and easier for users. Focus Focuses on how to retrieve data. Focuses on what data to retrieve.
  • 15. Tuple Relational Calculus (TRC) Definition: Queries are expressed using tuple variables, which represent rows (tuples) in a relation. Syntax t: A tuple variable. P(t): A predicate that specifies the condition(s) the tuple ttt must satisfy. Example: Retrieve names of employees earning more than $50,000:
  • 16. Components of TRC  Tuple Variables: Represent rows in a relation.  Predicates: Conditions involving attributes of tuples, constants, and logical operators ( , ,¬). ∧ ∨ Quantifiers:  Universal Quantifier ( ) ∀ : States that a condition holds for all tuples.  Existential Quantifier ( ) ∃ : States that there exists at least one tuple satisfying the condition.
  • 17. Domain Relational Calculus (DRC) Definition: Queries are expressed using domain variables, which represent individual attributes (columns) rather than entire tuples. Syntax: Example: Retrieve names of employees earning more than $50,000:
  • 18. Differences Between TRC and DRC Aspect Tuple Relational Calculus (TRC) Domain Relational Calculus (DRC) Variables Uses tuple variables (representing rows). Uses domain variables (representing columns). Focus Focuses on tuples (rows). Focuses on attributes (columns). Syntax ( { t P(t) } ) Complexity Easier for tuple-based conditions. Suitable for attribute-level queries.
  • 19. Codd's rules  Dr. Edgar F. Codd proposed Codd's 12 rules (or 13 including Rule 0) as a guideline for relational database systems.  These rules are intended to define what constitutes a true relational database system and ensure its adherence to relational principles.
  • 20. Rule 0: The Foundation Rule A system qualifies as a relational database management system (RDBMS) if it fully supports the relational model. Rule 1: The Information Rule All data should be stored in tables (relations), and all data is accessible through table column values. Rule 2: Guaranteed Access Rule Each data item (value) in a database must be accessible using a combination of a table name, primary key, and column name. Rule 3: Systematic Treatment of Null Values The database must allow null values to represent missing, unknown, or inapplicable information.
  • 21. Rule 4: Active Online Catalog Rule The database catalog, which contains metadata about the database, must be stored and accessed using the same relational database management system. Rule 5: The Comprehensive Data Sublanguage Rule A crucial component of any efficient database system is its ability to offer an easily understandable data manipulation language (DML) that facilitates defining, querying, and modifying information within the database. Rule 6: The View Updating Rule All views that are theoretically updatable must also be updatable by the system.
  • 22. Rule 8: Physical Data Independence Application programs and activities should remain unaffected when changes are made to the physical storage structures or methods. Rule 7: High-level Insert, Update, and Delete A successful database system must possess the feature of facilitating high-level insertions, updates, and deletions that can grant users the ability to conduct these operations with ease through a single query. Rule 9: Logical Data Independence Application programs and activities should remain unaffected when changes are made to the logical structure of the data, such as adding or modifying tables.
  • 23. Rule 10: Integrity Independence Integrity constraints should be specified separately from application programs and stored in the catalog. They should be automatically enforced by the database system. Rule 11: Distribution Independence The distribution of data across multiple locations should be invisible to users, and the database system should handle the distribution transparently. Rule 12: Non-Subversion Rule If the interface of the system is providing access to low-level records, then the interface must not be able to damage the system and bypass security and integrity constraints.
  • 24. Functional Dependencies • Functional Dependency (FD) is a constraint that describes the relationship between attributes in the relation (table). • FDs and Keys are used to define the normal forms for relations.
  • 25. Functional Dependencies Definition : Relation schema: R {A1,A2,...,An} X , Y are subsets of R If R: X Y then, If t1[X]=t2[X] then, t1[Y]=t2[Y] in any relation instance r(R) R t2 t1 Y X
  • 26. Examples for FD constraints.
  • 27. Examples for FD constraints. • Student ID determines Student name and Birth date. StID  {StName, Bdate} • Sport Name determines type of sport. SpName  type • Student ID and Sport Name determine the hours per week that the student practices his sport. {StID, SpName}  hours
  • 28. Functional Dependencies • A FD is a property of attributes in the relational schema R (intension). • If L is a key of the relation R, it determines all the attributes of R.
  • 29. Inference Rules for FDs. • Armstrong's inference rules A1. (Reflexive) If Y subset-of X, then X  Y A2. (Augmentation) If X  Y, then XZ  YZ (Notation: XZ stands for X U Z) A3. (Transitive) If X  Y and Y  Z, then X  Z
  • 30. Additional Useful Inference Rules. • Decomposition If X  YZ, then X  Y and X  Z • Union If X  Y and X  Z, then X  YZ • Psuedotransitivity If X  Y and WY  Z, then WX  Z
  • 31. Types of Functional Dependencies. 1. Trivial Functional Dependency. 2. Non-Trivial Functional Dependency. 3. Multi-valued Dependency. 4. Transitivity Dependency.
  • 32. 1. Trivial Functional Dependency. • The dependency of an attribute on a set of attributes is known as trivial functional dependency if the set of attributes includes that attribute. If B is a subset of A then, ABB AA BB A B
  • 33. 2. Non-Trivial Functional Dependency. • If a functional dependency X->Y holds true where Y is not a subset of X If B is not a subset of A then, AB A B
  • 34. 3. Multi-valued Dependency. • If there are more than one independent multi-valued attributes in a relation, that is called “multi-valued dependency”. bike_model manf_year colour V001 2011 Black V001 2011 Blue V002 2012 Black V002 2012 Blue V003 2013 Black V003 2013 Blue bike_model ->> manf_year bike_model ->> colour
  • 35. 4. Transitivity Dependency. • A functional dependency is said to be transitive if it is indirectly formed by two functional dependencies. Transitive dependency: XZ; if the following three functional dependencies hold TRUE, XY Y does not X YZ • Can only occur in a relation of three or more attributes. • Helps to normalizing the DB in 3NF.
  • 36. Example_Transitivity Dependency. Book Author Author_Age ABC Nimal Bandara 48 XY Sakunthala Weerasinghe 36 MNO Nimal Bandara 48 {Book}  {Author} {Author} does not  {Book} {Book} { Author_Age} Therefore Transitive Dependency is; {Book}  {Author_Age} ;