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

PPTX
Chapter-8 Relational Database Design
PPT
DBMS MODULE-5 normalisation in database management
PPT
DBMS-Unit-3.0 Functional dependencies.ppt
PPT
UNIT-IV.ppt
PDF
PDF
Introduction to database-Normalisation
PPT
ch7-clean.ppt
PPTX
Normalisation
Chapter-8 Relational Database Design
DBMS MODULE-5 normalisation in database management
DBMS-Unit-3.0 Functional dependencies.ppt
UNIT-IV.ppt
Introduction to database-Normalisation
ch7-clean.ppt
Normalisation

Similar to Introduction to database management system (20)

PPTX
DATABASE THOERY and practice o data.pptx
PPT
basic concepts of Entity relationship diagram
PPTX
Dbms ppt
PPTX
Normalization
PPTX
PPT
Database normalization
PPTX
data dependency in relational database management
PPTX
21CSC205P DBMS UNIT IV.pptx21CSC205P DBMS UNIT IV.pptx
PDF
[Www.pkbulk.blogspot.com]dbms09
PDF
Dbms unit-3
PPTX
Fd & Normalization - Database Management System
PPTX
Unit 3 dbms
PDF
Normalization.pdf
PDF
DBMS 3.pdf
PPTX
Relational Database Design Functional Dependency – definition, trivial and no...
PPTX
functional dependency in database (1).pptx
PDF
DBMS Part-4.pdf
PPTX
Normalization.pptx Functional dependence
PPTX
Functional dependency.pptx
DATABASE THOERY and practice o data.pptx
basic concepts of Entity relationship diagram
Dbms ppt
Normalization
Database normalization
data dependency in relational database management
21CSC205P DBMS UNIT IV.pptx21CSC205P DBMS UNIT IV.pptx
[Www.pkbulk.blogspot.com]dbms09
Dbms unit-3
Fd & Normalization - Database Management System
Unit 3 dbms
Normalization.pdf
DBMS 3.pdf
Relational Database Design Functional Dependency – definition, trivial and no...
functional dependency in database (1).pptx
DBMS Part-4.pdf
Normalization.pptx Functional dependence
Functional dependency.pptx
Ad

More from backiyalakshmi14 (10)

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

Recently uploaded (20)

PPTX
Software Engineering BSC DS UNIT 1 .pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Insiders guide to clinical Medicine.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PDF
High Ground Student Revision Booklet Preview
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PDF
Sunset Boulevard Student Revision Booklet
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
PDF
LDMMIA Reiki Yoga S2 L3 Vod Sample Preview
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
Landforms and landscapes data surprise preview
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
Software Engineering BSC DS UNIT 1 .pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Insiders guide to clinical Medicine.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Revamp in MTO Odoo 18 Inventory - Odoo Slides
How to Manage Loyalty Points in Odoo 18 Sales
High Ground Student Revision Booklet Preview
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
Sunset Boulevard Student Revision Booklet
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
LDMMIA Reiki Yoga S2 L3 Vod Sample Preview
Module 3: Health Systems Tutorial Slides S2 2025
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
NOI Hackathon - Summer Edition - GreenThumber.pptx
Landforms and landscapes data surprise preview
UPPER GASTRO INTESTINAL DISORDER.docx
Renaissance Architecture: A Journey from Faith to Humanism

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} ;