Relational Algebra Exercises
Relational Algebra Exercises
Relational Algebra Exercises
Exercises
Exercise - 1
1. Consider a db with the following schema:
Exercise - 1
• Write relational algebra expressions for the following:
Exercise - 2
Exercise - 3
Exercise - 4
•Consider the following relational database schema consisting of the four relation schemas:
• passenger ( pid, pname, pgender, pcity)
• agency ( aid, aname, acity)
• flight (fid, fdate, time, src, dest)
• booking (pid, aid, fid, fdate)
•Answer the following questions using relational algebra queries;
b) Get the details about all flights from Chennai to New Delhi.
d) Find the passenger names for passengers who have bookings on at least one flight.
• Π pname (passenger ⨝ booking)
e) Find the passenger names for those who do not have any bookings in any flights.
• Π pname ((Π pid (passenger) - Π pid (booking)) ⨝ passenger)