Professional Documents
Culture Documents
Module-2 Relational Algebra - Presentation
Module-2 Relational Algebra - Presentation
Module-2 Relational Algebra - Presentation
Relational
Algebra
C K Marigowda | Associate Professor & HOD | Information Science & Engineering | Acharya Institute of Technology |
marigowda@acharya.ac.in
Outline
▪ Unary Relational Operations
- SELECT operation
- PROJECT operation
- Sequences of unary operations
-RENAME operation
▪ Binary Relational Operations
- UNION operation
- INTERSECTION operation
- SET DIFFERENCE operation
Confidentiality
- CARTESIAN PRODUCT operation
- JOIN operation
Integrity
- DIVISION operation
▪ AGGREGATE
AvailabilityFunction
Unary Relational
Operations
C K Marigowda | Associate Professor & HOD | Information Science & Engineering | Acharya Institute of Technology |
marigowda@acharya.ac.in
COMPANY Database
Unary Relational Operations
Unary operations take one relation, and return one
relation:
– SELECT operation
– PROJECT operation
– RENAME operation
The SELECT Operation
▪ It selects a subset of tuples from a relation that
satisfy a SELECT condition
OR
Result NAME ( (DNO=1 AND SALARY>27000) (EMPLOYEE))
Binary Relational
Operations
C K Marigowda | Associate Professor & HOD | Information Science & Engineering | Acharya Institute of Technology |
marigowda@acharya.ac.in
Binary Relational Operations
- UNION operation
- INTERSECTION operation
- JOIN operation
- DIVISION operation
Confidentiality
Integrity
Availability
Binary Relational Operations
Two relations R1 and R2 are said to be union compatible
if they have the same degree and all their attributes
(correspondingly) have the same domain
R3 = R1 R2
R3 = R1 R2
R3 = R1 – R2
R3 = R1 X R2
R1 R2
FN LN FNAME LNAME
ABC A XYZ X
BCD D ACH M
R = R1 X R2
R
FN LN FNAME LNAME
ABC A XYX X
ABC A ACH M
BCD D XYZ X
BCD D ACH M
JOIN Operations
• An important operation for any relational database is
the JOIN operation, because it enables us to combine
related tuples from two relations into single tuple
R = R1 ⋈ <join condition> R2
degree(R1) + degree(R2)
Example
Result of the JOIN operation
Name SSN DOB Salary Address SuperSSN DNo DName DNumber MGRSSN
Ashok 123456789 20-May-70 25000 JP Nagar, 103456789 1 ES 1 123456789
Bangalore
Raju 103456789 10-Oct-80 30000 Vijayanagar, 103456789 2 DD 2 103456789
Bangalore
The JOIN Operation
• The difference between CARTESIAN PRODUCT and
JOIN is that the resulting relation from JOIN consists
only those tuples that satisfy the join condition
R3 = R1 * R2
R3 = R1 ÷ R 2
SSN_PNOS ÷ SMITH_PNOS
Aggregate
functions
C K Marigowda | Associate Professor & HOD | Information Science & Engineering | Acharya Institute of Technology |
marigowda@acharya.ac.in
Example
The AGGREGATE FUNCTION operation
Thank you
marigowda@acharya.ac.in
www.acharya.ac.in