SlideShare une entreprise Scribd logo
1  sur  16
Relational Algebra 
Relational Algebra is : 
• The formal description of how a relational database operates 
• An interface to the data stored in the database itself 
• The mathematics which underpin SQL operations 
Operators in relational algebra are not necessarily the same as SQL operators, even 
if they have the same name. 
For example, the SELECT statement exists in SQL, and also exists in relational 
algebra. These two uses of SELECT are not the same. The DBMS must take whatever 
SQL statements the user types in and translate them into relational algebra 
operations before applying them to the database.
Important Terminology 
• Relation - a set of tuples. 
• Tuple - a collection of attributes which describe some real 
world entity. 
• Attribute - a real world role played by a named domain. 
• Domain - a set of atomic values. 
• Set - a mathematical definition for a collection of objects 
which contains no duplicates.
Operators -Write 
• INSERT - provides a list of attribute values for a new tuple in a relation. This 
operator is the same as SQL. 
• DELETE - provides a condition on the attributes of a relation to determine which 
tuple(s) to remove from the relation. This operator is the same as SQL. 
• MODIFY - changes the values of one or more attributes in one or more tuples of a 
relation, as identified by a condition operating on the attributes of the relation. 
This is equivalent to SQL UPDATE. 
Operators –Retrieval 
There are two groups of operations: 
• Mathematical set theory based relations: 
UNION, INTERSECTION, DIFFERENCE, and CARTESIAN PRODUCT. 
• Special database operations: 
SELECT (not the same as SQL SELECT), PROJECT, and JOIN.
Relational SELECT 
• SELECT is used to obtain a subset of the tuples of a relation that satisfy a select 
condition. 
For example, find all employees born after 1st Jan 1950: 
SELECTdob '01/JAN/1950'(employee) 
Relational PROJECT 
• The PROJECT operation is used to select a subset of the attributes of a relation 
by specifying the names of the required attributes. 
For example, to get a list of all employees surnames and employee numbers: 
PROJECTsurname,empno(employee)
• SELECT and PROJECT 
SELECT and PROJECT can be combined together. 
For example, to get a list of employee numbers for employees in 
department number 1:
JOIN Operator 
• JOIN is used to combine related tuples from two relations: 
• In its simplest form the JOIN operator is just the cross product of 
the two relations. 
• As the join becomes more complex, tuples are removed within 
the cross product to make the result of the join more meaningful. 
• JOIN allows you to evaluate a join condition between the 
attributes of the relations on which the join is undertaken. 
The notation used is 
R JOINjoin condition S
The relational model is based on the principle of relational algebra. 
Relational algebra is a collection of operators that operate on 
relations. Each operator takes one or two relations as its input and 
produces a new relation as its output. 
RESTRICT: 
The Restrict operator extracts specified tuples or rows from a given relation, based on a 
condition. 
For example, a student table has the attributes ROLL NO[ roll number], STUDNAME [ student 
name], AGE and GENDER. The condition is to extract the tuples of only those students whose 
age is more than 25. The resultant relation appears, as follows:
PROJECT : 
• The Project operator extracts specified attributes or columns 
from a given relation 
For example, if only the name and age of the students is to be 
extracted, the resultant relation appears, as follows [assume 
that the student table has only six tuples]
PRODUCT : 
The product operator builds a relation from two specified 
relations. It consists of an possible combinations of tuples, one 
from each of the two relations. 
To be product compatible, the two tables must have common attributes. 
The Product operator creates Cartesian product between the two tables.
UNION : 
• The Union operator builds a relation from tuples appearing in either or both 
of the specified relations. 
• To be union compatible, the two tables should have the same types of 
attributes [sets of columns having the same data types] 
• For example, Consider two tables A and B. 
• A contains the roll numbers and names of all students whose major 
discipline is computer science. B contains the roll numbers and names of all 
students whose major discipline is mathematics. These tables are union 
compatible because they have the same types of attributes.
Relational Calculus 
Relational algebra is a procedural language, in which user has to write the steps or 
procedure to obtain the required results but in general a user should not have to be 
concerned with the details of how to obtain information. In relational calculus user 
is not concerned with the procedure to obtain the results, he/she just tell his/her 
requirements and the output is available without knowing the method about its 
retrieval 
In relational calculus, a query is expressed as a formula consisting of a number of 
variables and an expression involving these variables. It is up to the DBMS to 
transform these nonprocedural queries into equivalent, efficient, procedural 
queries. 
The relational calculus is used to measure the selective power of relational 
languages. A language that can be used to produce any relation that can be derived 
using the relational calculus is said to be relationally complete.
Relational Calculus 
Relation calculus, which in effect means calculating with relations, is based on 
predicate calculus, which is calculating with predicates. It is a formal language used 
to symbolize logical arguments in mathematics. Propositions specifying a property 
consist of an expression that names an individual object, and another expression, 
called the predicate, that stands for the property that the individual object 
possesses. 
If for instance, p and q are propositions, we can build other propositions "not p", "p 
or q", "p and q" and so on. In predicate calculus, propositions may be built not only 
out of other propositions but also out of elements that are not themselves 
propositions. In this manner we can build a proposition that specifies a certain 
property or characteristic of an object.
Relational Calculus can be classified in two categories: 
• Tuple Oriented relational Calculus 
• Domain Oriented relational calculus 
In relational tuple calculus, the variables represent the tuples 
from specified relations; in relational domain calculus, the 
variables represent values drawn from specified domains.
Tuple Oriented Relational Calculus 
The tuple relational calculus is based on specifying a number of tuple variables. Each 
such tuple variable normally ranges over a particular database relation. This means 
that the variable may take any individual tuple from that relation as its value. 
A simple tuple relational calculus query is of the form { t I COND(t)·}, where '1' is a 
tuple variable and COND(t) is a conditional expression involving '1'. The result of such 
a query is a relation that contains all the tuples (rows) that satisfy COND(t) 
For example, 
The relational calculus query {t I BOOK(t) and t.PRICE>lOO} will get you all the books 
whose price is greater than 100. In the above example, the condition 'BOOK(t)' 
specifies that the range relation of the tuple variable '1' is BOOK. Each BOOK tuple 't' 
that satisfies the condition 't.PRICE> 100' will be retrieved. Note that 't.PRICE' 
references the attribute PRICE of the tuple variable '1'.
Domain Oriented Relational Calculus 
The domain calculus differs from the tuple calculus in the type of variables used 
in formulas. In domain calculus the variables range over single values from 
domains of attributes rather than ranging over tuples. To form a relation of 
degree 'n' for a query result, we must have 'n' of these domain variables-one for 
each attribute. 
An expression of the domain calculus is of the following form: 
• {Xl, X2, ... , Xn I COND(XI, X2, .. ·, Xn, Xn+b Xn+2, , Xn+m)} 
In the above expression Xl, X2, ... , Xn, Xn+b Xn+2, , Xn+m are domain variables 
that range over domains of attributes and COND is a condition or formula of the 
domain relational calculus.
Expression of the domain calculus are constructed from the following 
elements: 
Domain variables Xl, X2, ... , Xn, Xn+b Xn+2, ... , Xn+m each domain variable is 
to range over some specified domain . 
• Conditions, which can take two forms: 
• Simple comparisons of the form x * y, as for the tuple calculus, except that x and yare now domain variables. 
• Membership conditions, of the form R (term, 
term ...). 
Here, R is a relation, and each "term" is a pair AV, where A in turn is an attribute 
Of R and V is either a domain variable or a constant. 
For example EMP (empno: 100, ename: 'Ajay') is a membership condition (which evaluates to 
true if and only if there exists an EMP tuple having empno=100 and ename = 'Ajay') .

Contenu connexe

Tendances

Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancyVisakh V
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introductionSmriti Jain
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculusSalman Vadsarya
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Mapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODELMapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODELRUpaliLohar
 
DBMS Integrity rule
DBMS Integrity ruleDBMS Integrity rule
DBMS Integrity ruleGirdharRatne
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra pptGirdharRatne
 
Presentation on Relational Schema (Database)
Presentation on Relational Schema (Database)Presentation on Relational Schema (Database)
Presentation on Relational Schema (Database)Salim Hosen
 

Tendances (20)

ER MODEL
ER MODELER MODEL
ER MODEL
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancy
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
3 Data Structure in R
3 Data Structure in R3 Data Structure in R
3 Data Structure in R
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Mapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODELMapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODEL
 
ER Diagram
ER DiagramER Diagram
ER Diagram
 
1643 y є r relational calculus-1
1643 y є r  relational calculus-11643 y є r  relational calculus-1
1643 y є r relational calculus-1
 
DBMS Integrity rule
DBMS Integrity ruleDBMS Integrity rule
DBMS Integrity rule
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Presentation on Relational Schema (Database)
Presentation on Relational Schema (Database)Presentation on Relational Schema (Database)
Presentation on Relational Schema (Database)
 

En vedette

Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbmsshekhar1991
 
Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)yourbookworldanil
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebraguest20b0b3
 
Introduction to Relational Algebra
Introduction to Relational AlgebraIntroduction to Relational Algebra
Introduction to Relational AlgebraJames McMurray
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systemsjakodongo
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusemailharmeet
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dosvanamali_vanu
 
DBMS FOR STUDENTS MUST DOWNLOAD AND READ
DBMS FOR STUDENTS MUST DOWNLOAD AND READDBMS FOR STUDENTS MUST DOWNLOAD AND READ
DBMS FOR STUDENTS MUST DOWNLOAD AND READamitp26
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Vidyasagar Mundroy
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, proceduresVaibhav Kathuria
 
Design principles of scalable, distributed systems
Design principles of scalable, distributed systemsDesign principles of scalable, distributed systems
Design principles of scalable, distributed systemsTinniam V Ganesh (TV)
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Prosanta Ghosh
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniquespusp220
 

En vedette (20)

Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Introduction to Relational Algebra
Introduction to Relational AlgebraIntroduction to Relational Algebra
Introduction to Relational Algebra
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systems
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculus
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dos
 
DBMS FOR STUDENTS MUST DOWNLOAD AND READ
DBMS FOR STUDENTS MUST DOWNLOAD AND READDBMS FOR STUDENTS MUST DOWNLOAD AND READ
DBMS FOR STUDENTS MUST DOWNLOAD AND READ
 
Database Lecture Notes
Database Lecture NotesDatabase Lecture Notes
Database Lecture Notes
 
DDBMS
DDBMSDDBMS
DDBMS
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, procedures
 
TRIGGERS
TRIGGERSTRIGGERS
TRIGGERS
 
Design principles of scalable, distributed systems
Design principles of scalable, distributed systemsDesign principles of scalable, distributed systems
Design principles of scalable, distributed systems
 
Trigger
TriggerTrigger
Trigger
 
Sql ch 13 - sql-views
Sql ch 13 - sql-viewsSql ch 13 - sql-views
Sql ch 13 - sql-views
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Data recovery
Data recoveryData recovery
Data recovery
 

Similaire à Relational algebra calculus

E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2Mukund Trivedi
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)Mukund Trivedi
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)Mukund Trivedi
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 
316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasexabhaysonone0
 
Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational modelATS SBGI MIRAJ
 
5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptxkavitha623544
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational AlgebraKunal Anand
 
Info_Management_report-1.pptx
Info_Management_report-1.pptxInfo_Management_report-1.pptx
Info_Management_report-1.pptxChingChingErm
 
Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfajajkhan16
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf10GUPTASOUMYARAMPRAK
 
Introduction to Relational Database Management Systems
Introduction to Relational Database Management SystemsIntroduction to Relational Database Management Systems
Introduction to Relational Database Management SystemsAdri Jovin
 
Relational Database and Relational Algebra
Relational Database and Relational AlgebraRelational Database and Relational Algebra
Relational Database and Relational AlgebraPyingkodi Maran
 
Relational algebra (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)usama nizam
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.pptShylaja40
 
relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)Nilt1234
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxRoshni814224
 

Similaire à Relational algebra calculus (20)

Relational model
Relational modelRelational model
Relational model
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex
 
DBMS UNIT 3
DBMS UNIT 3DBMS UNIT 3
DBMS UNIT 3
 
Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational model
 
5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational Algebra
 
Info_Management_report-1.pptx
Info_Management_report-1.pptxInfo_Management_report-1.pptx
Info_Management_report-1.pptx
 
Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdf
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf
 
Introduction to Relational Database Management Systems
Introduction to Relational Database Management SystemsIntroduction to Relational Database Management Systems
Introduction to Relational Database Management Systems
 
Relational Database and Relational Algebra
Relational Database and Relational AlgebraRelational Database and Relational Algebra
Relational Database and Relational Algebra
 
Relational algebra (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.ppt
 
relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptx
 
Query trees
Query treesQuery trees
Query trees
 

Dernier

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Dernier (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Relational algebra calculus

  • 1. Relational Algebra Relational Algebra is : • The formal description of how a relational database operates • An interface to the data stored in the database itself • The mathematics which underpin SQL operations Operators in relational algebra are not necessarily the same as SQL operators, even if they have the same name. For example, the SELECT statement exists in SQL, and also exists in relational algebra. These two uses of SELECT are not the same. The DBMS must take whatever SQL statements the user types in and translate them into relational algebra operations before applying them to the database.
  • 2. Important Terminology • Relation - a set of tuples. • Tuple - a collection of attributes which describe some real world entity. • Attribute - a real world role played by a named domain. • Domain - a set of atomic values. • Set - a mathematical definition for a collection of objects which contains no duplicates.
  • 3. Operators -Write • INSERT - provides a list of attribute values for a new tuple in a relation. This operator is the same as SQL. • DELETE - provides a condition on the attributes of a relation to determine which tuple(s) to remove from the relation. This operator is the same as SQL. • MODIFY - changes the values of one or more attributes in one or more tuples of a relation, as identified by a condition operating on the attributes of the relation. This is equivalent to SQL UPDATE. Operators –Retrieval There are two groups of operations: • Mathematical set theory based relations: UNION, INTERSECTION, DIFFERENCE, and CARTESIAN PRODUCT. • Special database operations: SELECT (not the same as SQL SELECT), PROJECT, and JOIN.
  • 4. Relational SELECT • SELECT is used to obtain a subset of the tuples of a relation that satisfy a select condition. For example, find all employees born after 1st Jan 1950: SELECTdob '01/JAN/1950'(employee) Relational PROJECT • The PROJECT operation is used to select a subset of the attributes of a relation by specifying the names of the required attributes. For example, to get a list of all employees surnames and employee numbers: PROJECTsurname,empno(employee)
  • 5. • SELECT and PROJECT SELECT and PROJECT can be combined together. For example, to get a list of employee numbers for employees in department number 1:
  • 6. JOIN Operator • JOIN is used to combine related tuples from two relations: • In its simplest form the JOIN operator is just the cross product of the two relations. • As the join becomes more complex, tuples are removed within the cross product to make the result of the join more meaningful. • JOIN allows you to evaluate a join condition between the attributes of the relations on which the join is undertaken. The notation used is R JOINjoin condition S
  • 7. The relational model is based on the principle of relational algebra. Relational algebra is a collection of operators that operate on relations. Each operator takes one or two relations as its input and produces a new relation as its output. RESTRICT: The Restrict operator extracts specified tuples or rows from a given relation, based on a condition. For example, a student table has the attributes ROLL NO[ roll number], STUDNAME [ student name], AGE and GENDER. The condition is to extract the tuples of only those students whose age is more than 25. The resultant relation appears, as follows:
  • 8. PROJECT : • The Project operator extracts specified attributes or columns from a given relation For example, if only the name and age of the students is to be extracted, the resultant relation appears, as follows [assume that the student table has only six tuples]
  • 9. PRODUCT : The product operator builds a relation from two specified relations. It consists of an possible combinations of tuples, one from each of the two relations. To be product compatible, the two tables must have common attributes. The Product operator creates Cartesian product between the two tables.
  • 10. UNION : • The Union operator builds a relation from tuples appearing in either or both of the specified relations. • To be union compatible, the two tables should have the same types of attributes [sets of columns having the same data types] • For example, Consider two tables A and B. • A contains the roll numbers and names of all students whose major discipline is computer science. B contains the roll numbers and names of all students whose major discipline is mathematics. These tables are union compatible because they have the same types of attributes.
  • 11. Relational Calculus Relational algebra is a procedural language, in which user has to write the steps or procedure to obtain the required results but in general a user should not have to be concerned with the details of how to obtain information. In relational calculus user is not concerned with the procedure to obtain the results, he/she just tell his/her requirements and the output is available without knowing the method about its retrieval In relational calculus, a query is expressed as a formula consisting of a number of variables and an expression involving these variables. It is up to the DBMS to transform these nonprocedural queries into equivalent, efficient, procedural queries. The relational calculus is used to measure the selective power of relational languages. A language that can be used to produce any relation that can be derived using the relational calculus is said to be relationally complete.
  • 12. Relational Calculus Relation calculus, which in effect means calculating with relations, is based on predicate calculus, which is calculating with predicates. It is a formal language used to symbolize logical arguments in mathematics. Propositions specifying a property consist of an expression that names an individual object, and another expression, called the predicate, that stands for the property that the individual object possesses. If for instance, p and q are propositions, we can build other propositions "not p", "p or q", "p and q" and so on. In predicate calculus, propositions may be built not only out of other propositions but also out of elements that are not themselves propositions. In this manner we can build a proposition that specifies a certain property or characteristic of an object.
  • 13. Relational Calculus can be classified in two categories: • Tuple Oriented relational Calculus • Domain Oriented relational calculus In relational tuple calculus, the variables represent the tuples from specified relations; in relational domain calculus, the variables represent values drawn from specified domains.
  • 14. Tuple Oriented Relational Calculus The tuple relational calculus is based on specifying a number of tuple variables. Each such tuple variable normally ranges over a particular database relation. This means that the variable may take any individual tuple from that relation as its value. A simple tuple relational calculus query is of the form { t I COND(t)·}, where '1' is a tuple variable and COND(t) is a conditional expression involving '1'. The result of such a query is a relation that contains all the tuples (rows) that satisfy COND(t) For example, The relational calculus query {t I BOOK(t) and t.PRICE>lOO} will get you all the books whose price is greater than 100. In the above example, the condition 'BOOK(t)' specifies that the range relation of the tuple variable '1' is BOOK. Each BOOK tuple 't' that satisfies the condition 't.PRICE> 100' will be retrieved. Note that 't.PRICE' references the attribute PRICE of the tuple variable '1'.
  • 15. Domain Oriented Relational Calculus The domain calculus differs from the tuple calculus in the type of variables used in formulas. In domain calculus the variables range over single values from domains of attributes rather than ranging over tuples. To form a relation of degree 'n' for a query result, we must have 'n' of these domain variables-one for each attribute. An expression of the domain calculus is of the following form: • {Xl, X2, ... , Xn I COND(XI, X2, .. ·, Xn, Xn+b Xn+2, , Xn+m)} In the above expression Xl, X2, ... , Xn, Xn+b Xn+2, , Xn+m are domain variables that range over domains of attributes and COND is a condition or formula of the domain relational calculus.
  • 16. Expression of the domain calculus are constructed from the following elements: Domain variables Xl, X2, ... , Xn, Xn+b Xn+2, ... , Xn+m each domain variable is to range over some specified domain . • Conditions, which can take two forms: • Simple comparisons of the form x * y, as for the tuple calculus, except that x and yare now domain variables. • Membership conditions, of the form R (term, term ...). Here, R is a relation, and each "term" is a pair AV, where A in turn is an attribute Of R and V is either a domain variable or a constant. For example EMP (empno: 100, ename: 'Ajay') is a membership condition (which evaluates to true if and only if there exists an EMP tuple having empno=100 and ename = 'Ajay') .