virtualgate's picture

Relational Algebra, Relational Calculus

Lecture on Relation Algebra
Content covered: 

Introduction to RA, The role of RA in SQL

More Less
0Comment
Lecture on Select Operation
Content covered: 

How SELECT operation works

More Less
0Comment
Lecture on Project Operation
Content covered: 

Working of PROJECT operation in Relation Algebra

  • Select and Project are unary operations, that works on a single relation.
  • Select and Project are commutative in nature.
  • Example:
    ID Name CGPA

    2

    B 9.6
    3 C 9.2
    7 B 9.8
  • Q: Select name of students whose CGPA is greater than 9
    A:σnameCGPA>9(Student)]
  • Resulting table :
    Name
    B
    C
  • Note:In a set there is no repetition of elements.
More Less
3Comments
Lecture on Union Compatibility & Union
Content covered: 

Union compatibility, Union Operation in Relational Algebra

More Less
0Comment
Lecture on Intersection
Content covered: 

Consider the two sets A = {1, 2, 4 ,6} and B ={1, 3, 6}.
Intersection of set A and B = A ∩ B = {1, 6}
Elements that are present in both the sets A and B will only present in the set obtained by intersection of A and B.
Similarly in relational algebra, if r1 and r2 are two instances of relation then
r1 ∩ r2 = { t | t ∈ r AND t ∈ r} 
It means that in the intersection of  r1 and ronly those tuples will be present that are in both  r1 and r.
Example: Find all the customers who has an account in the bank as well as they have taken loan.
Expression:- πname (Depositor) ∩ πname (Borrower).
We can understand this by taking tables.
Depositor:

ID NAME
1 A
2 B
3 C

Borrower:

ID NAME
2 B
3 A
5 D

So intersection table will be,

 

NAME
A
B

 

More Less
0Comment
Lecture on Cross Product
Content covered: 

Cross Product in Relational Algebra

More Less
2Comments
Lecture on Rename
Content covered: 

Rename Operation in Relational Algebra

More Less
0Comment
Lecture on Join Operation
Content covered: 

Introduction to Join in Relational Algebra

More Less
0Comment
Lecture on Inner Join
Content covered: 

Inner join and it's types: Theta Join, Equi Join and Natural Join

More Less
1Comment
Lecture on Outer Join
Content covered: 

Outer Join and it's type : Left Outer, Right Outer and Full Outer Join

More Less
0Comment
Lecture on Division
Content covered: 

Concept of Division Operation

More Less
0Comment
Lecture on The Complete Set of Operation
Content covered: 

What are the must have operations in RA

More Less
0Comment
Using Quantifiers in Tupe Relational Query
Content covered: 

How to use Quantifiers in Tupe Relational Query

More Less
0Comment
Well Known Transformation Formula
Content covered: 

Basic Well Known Transformation Formula of Predicate Logic

More Less
0Comment
Changing Quantification and Safe Expression
Content covered: 

Example on Changing Quantification and understanding Safe Expression

More Less
2Comments

depositor ( cust_name, account_no )
borrower ( cust_name, loan_no )
loan ( loan_no, branch_name, amount )
customer ( cust_name, city, street )
account ( acc_no, branch_name, balance )
branch ( branch_name, branch_city, assets )

Q1 : Find the loan detail of the loan above 1200;
Q2: Find the name of all customers who have a loan from branch 'X'
Q3: Customer who have account or loan or both

Consider the following relation:

Employee( FirstName, LastName, Eid, DOB, Address, Sex, Salary, Dno ) &
Department( Dno, DName, Mid )

Query: List the name of employee who have no department to manage. 

Consider the following relational schema:
Student(name, sex, marks)
Then what does the following relational algebra prints?
Πnamesex=female(student)) − (Πname(student ρn,x,m(student) on sex=female ∧ x=male marks ≤ m))

(A) names of girls with highest marks
(B) names of girls with more marks than some boy
(C) names of girls with more marks than all boys
(D) names of girls with marks not less than some boy

  • This quiz contains 5 questions on the topic Query Language
  • Lean well before you attempt the quiz
  • You can attempt the quiz unlimited number of times.

Difficulty Level:  intermediate