0% found this document useful (0 votes)
83 views

Dbms Assignment 21cs53

The document provides examples of queries formulated in relational algebra based on given relational schemas. It includes queries to retrieve names of students enrolled in specific subjects, names of all students and subjects they take, names of teachers for subjects, names of students taking subjects taught by a given teacher, and more. It also provides examples of queries on user, occupation, and city schemas, as well as movie, actor, director schemas. Finally, it lists queries involving schemas for sailors, boats, reservations, passengers, agencies, and flights.

Uploaded by

ipl96875
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)
83 views

Dbms Assignment 21cs53

The document provides examples of queries formulated in relational algebra based on given relational schemas. It includes queries to retrieve names of students enrolled in specific subjects, names of all students and subjects they take, names of teachers for subjects, names of students taking subjects taught by a given teacher, and more. It also provides examples of queries on user, occupation, and city schemas, as well as movie, actor, director schemas. Finally, it lists queries involving schemas for sailors, boats, reservations, passengers, agencies, and flights.

Uploaded by

ipl96875
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/ 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