You are on page 1of 4

AMC ENGINEERING COLLEGE, BENGALURU- 560 083

DEPARTMENT OF COMPUTER SCIENCE

Database Management System(21CS53)

1)

Formulate Queries in Relational Algebra


Give the following queries in the relational algebra using the relationalschema
student(id, name) enrolledIn(id,
code) subject(code, lecturer)

1. What are the names of students enrolled in cs3020?


2. Which subjects is Hector taking?
3. Who teaches cs1500?
4. Who teaches cs1500 or cs3020?
5. What are the names of students in cs1500 or cs3010?
6. What are the names of students in both cs1500 and cs1200?
7. What are the codes of all the subjects taught?
8.What are the names of all the students?
9. What are the names of all the students in cs1500?
10. What are the names of students taking a subject taught by Roger.
2)

1) find the name of the user whose age is greater than 25


2) find the user whose id is grater than 2 or his age is not equal to 31
3) find the name and gender of a person who is working in boston city
4) display the result of User ⋈ Occupation ⋈ City
3)

1. Find movies made after 1997


2. Find movies made by Hanson after 1997
3. Find all movies and their ratings
4. Find all actors and directors
5. Find Coen’s movies with McDormand
6. Find movies with Maguire but not McDormand
7. Find actors who have acted in some Coen’s movie
8. Find (director, actor) pairs where the director is younger than theactor
9. Find actors who have acted in all of Coen’s movies

4)
Consider following schema and write relational algebra?
Sailors(SID,sname,Rating,Age)
Boat(BID,bname,color)
Reserve(SID, BID,day)

i) Retrieve the sailor name who reserved red and green boats
ii) Retrieve the sailor name with age over 20 years and reserved red boat?
iii) Retrieve the sailor name who reserved atleast one boat?
iv)Find the name of sailor who reserved all the boats?
5)
Passenger(Pid, PName, PGender, PCity)
Agency(Aid,AName, ACity)
Flight(Fid ,FDate,Time,Src,Dest)
Booking(Pid,Aid,Fid, FDate)

1. Get the complete details of all flights to NewDelhi


2. Find the passenger names for those who do not have any bookings in any flights
3. Get the details of the flights that are scheduled on both dates 1/12/2022 and 2/12/2022 at
16:00 hrs
4. Find the details of male passenger who are associated with jet agency.

You might also like