Lab Assignment-1
Lab Assignment-1
[CLO1] In this assignment, you are to write relational algebra queries over a small sample database. It contains
four relations:
I have also added few tuples in each of the relations. You can view them in Database.xlsx file. You are to write
relational algebra expressions over the database for the following 9 queries. I have also provided the results
for each of the query. You need to figure out the query in relational algebra that must produce the same result.
To verify if your query would produce the same result, I recommend you to execute it using web-based RA
calculator – RelaX (https://dbis-uibk.github.io/relax/landing). For each of the following queries, write down the
expressions using standard RA notations along with the corresponding expression tree representation and the
number of rows returned in results.
1 - Find all pizzas eaten by at least one female over the age of 19. [1.5 marks]
cheese
chicken tikka
Mushroom
2 - Find the names of all females who eat at least one pizza served by Rahat. (Note: The pizza need not be
eaten at Rahat.) [1.5 marks]
Amna
Hamna
3 - Find all restaurants that serve at least one pizza for less than Rs.1000 that either Amna or Faria (or both)
eat. [1.5 marks]
Italian Oven
Pappasallis
Rahat
4 - Find all restaurants that serve at least one pizza for less than Rs.1000 that both Amna and Faria eat. [1.5
marks]
Italian Oven
5 - Find the names of all people who eat at least one pizza served by Dominos but who do not visit Dominos.
[1.5 marks]
Amna
Bilal
Danish
Ehsan
Gauhar
6 - Find all pizzas that are eaten only by people younger than 24, OR that cost less than Rs.1000 everywhere
they are served. [2.5 marks]
cheese
fajita
sausage
7 - Find the age of the oldest person who eat mushroom pizza. [5 marks]
24
8 - Find all restaurants that serve ONLY pizzas eaten by people over 30. [5 marks]
Tehzeeb
9 - Find all restaurants that serve EVERY pizza eaten by people over 30. [5 marks]
Pappasallis
Pizza Hut
Tehzeeb