Professional Documents
Culture Documents
Questions
Q1. Consider a data base with the following schema
Answers
1. code ( Course ) - code ( Registered )
2. name ( (code ( Course ) - code ( Registered )) Course)
3. name,title ( Student Registered Course)
4. ssn ( Student Registered ( title=Database Systems Course)) ssn ( Student
Registered ( title=Analysis of Algorithms Course))
5. ssn ( Student Registered ( title=Database Systems Course)) ssn ( Student
Registered ( title=Analysis of Algorithms Course))
6. code, ssn ( Registered ) / ssn ( Student )
Give the following queries in the relational algebra using the relational schema
student(id, name)
enrolledIn(id, code)
subject(code, lecturer)
Answers
1. name( cs3020=code(student enrolledIn))
2. code( name=Hector(student enrolledIn))
3. lecturer( code=cs1500(subject))
4. lecturer( code=cs1500 code=cs3020(subject))
5. Solution: For this query we have to relate subject to itself. To disambiguate the relation,
we will call the subject relation R or S.
10. name(student)