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

DBMS

Uploaded by

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

DBMS

Uploaded by

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

Relational Algebra

Presented by

MD. Fardin Omar Hamim

ID: 202231064187

Sadia Akter Lopa

ID:202231064156
Content:

● Relational Algebra Concept


● Key Operations of Relational Algebra
● Key Operations Concept
● Example of Key Operations
What is Relational Algebra?
Relational Algebra is a theoretical
query language.

❏ It is a set of algebraic operation.


❏ Input : One or more relations.
❏ Output : A relation.
Operators Of Relational Algebra

Relational Algebra defines a variety of


operators to work with relations these are:
❏ Select Operation (σ)
❏ Project Operation (π)
❏ Rename Operation (ρ)
Select Operation (σ):

● Select tuples that satisfy a given predicate.


● Denoted by lowercase Greek letter sigma (σ).

● Syntax: σ <selection_condition> (Relation).


Example: Find all the persons which hobby is ‘stamps’.

Solution: σ Hobby = “Stamps” (Person)


Output:
Project Operation (π):

● It projects column(s) that satisfy a given


predicate.
● Denoted by the uppercase Greek letter Pi(π).

● Syntax: π Attribute1,Attribute2,…(Relation).
Example: Project attribute Name and Hobby.

Solution: π Name, Hobby (Person)


Output:
Combining Select and project operation:
Example:Find only the names of the employees who drives
Red car. Employee

Solution: πFname, LName(σColor= ‘Red’(Employee))


Output:
Rename Operation (ρ):

● The Rename operation is used to rename the


output of a relation.
● Denoted by lowercase Greek letter rho (ρ).
● Syntax: ρNewRelationName(NewAttr1,NewAttr2,...,NewAttrN)(Relation).
Example:Rename the attribute of name as EmployeeName.

Solution: ρ(EmployeeName, EmployeeID) (Employee) Employee


Output:
Combining Select,project and Rename operation:
Example:Select employees from the "IT" department, Project
only their EmpID and Salary and Rename the resulting relation
to IT_Employees with attributes ID and Pay.
Employee
Solution:
ρIT_Employees(ID,Pay)(πEmpID,Salary(σDepartment=′IT′(Employee)))

Output:
IT_Employees
“Embrace failure as a necessary step
toward success.”
J.K. Rowling

You might also like