34.6k views
2 votes
Consider following schema , write relational algebra statment for :

Student ( S_id , name , address, subject )
Course ( C_code , title )
Enroll ( S_id , C_code )
_________
i ] List the titles of course that have students enrolled on them.
_________
ii] List the names of student and the titles of the course that they are registered.
_________
iii ] List the names of students who are Enroll either for the database course or for the Java course.
━━━━━━━━━━━━━━━━━━━━━━━
Don't Spam !
Thank You! :)


1 Answer

3 votes

Answer:

i] PROJECTION (title) (SELECT (C_code) (ENROLL))

ii] PROJECTION (name, title) (JOIN (ENROLL (S_id, C_code)) (STUDENT (S_id, name)) (COURSE (C_code, title)))

iii] PROJECTION (name) (SELECT (S_id) (JOIN (ENROLL (S_id, C_code)) (STUDENT (S_id, name)) (COURSE (C_code, title)) (C_code = ‘Database’ OR C_code = ‘Java’)))

User Fannie
by
8.2k points