Due date: 5pm – Friday of week 5.
Late submission is not acceptable
Question 1
Consider the relations
![]() |
Show the results of the following expressions.
1.
2.
3.
Question 2
Consider two relations R1 and R2, where R1 contains N1 tuples and R2 contains N2 tuples, and N1 > N2 > 0. Give the minimum and maximum possible sizes (in tuples) for the result relation produced by each of the following relational algebra expressions. In each case state any assumptions about the schemas of R1 and R2 that are needed to make the expression meaningful.
1.
2.
3.
4.
5.
6.
7.
Question 3
Consider the following database schema
Student (StudentId, FullName, BDate, Address)
Course (Code, Name, Lecturer)
Enrol(StudentId, Code, Grade)
Specify the following queries in relational algebra
- List the name of all courses
- List the StudentId, FullName of students who lives in Hanoi
- List the StudentId of students who enrol in course ‘COMP-1101’ but not in course ‘COMP-1102’
- List the name of students who enrol in both course ‘COMP-1101’ and course ‘COMP-1102’
- List the name, lecturer of all course in which student ‘John Smith’ has enroled
- List the name of student who enrol in at least one course teach by Professor Le Quan
- List the name, address of all student who enrol in every course teach by Professor Le Quan
- List the name of the course which has no student enrolled in







