Assignment - Relational Algebra
Assignment - Relational Algebra
Total Point: 10
Student’s Name:
Task A:
Using the tables in page 2, construct relational algebra expressions to answer the
following queries and represent the answer as a relation (output table):
Solution:
Output Table:
2. Which staff members were born after 1955? Include only staff numbers
and names.
Solution:
Output Table:
staffNo fName lName
SA9 Mary Howe
SG14 David Ford
SG37 Ann Beech
SL41 Julie Lee
1 | Page
3. List the flats with rent greater than $500.
Solution:
RA expression: Π street, city, rent (σ type = 'Flat' AND rent > 500
(PropertyForRent))
Output Table:
Solution:
Output Table:
telNo
0141-357-7419
2 | Page
Task B:
[1*5 = 5]
Using the tables in page 2, show the relation (table including column headings)
created by the following relational algebra expressions as a two-dimensional table:
Solution:
Table:
fName lName Rooms rent
Aline Stewart 4 $450.00
Aline Stewart 3 $375.00
Aline Stewart 3 $350.00
Aline Stewart 4 $400.00
Mary Tregear 4 $450.00
Mary Tregear 3 $375.00
Mary Tregear 3 $350.00
Mary Tregear 4 $400.00
Mike Ritchie 6 $650.00
Mike Ritchie 5 $600.00
John Kay 4 $450.00
John Kay 3 $375.00
John Kay 3 $350.00
John Kay 4 $400.00
Solution:
Table:
lName Position
Lee Assistant
3 | Page
3. Π staffNo ( Registeration ) Π staffNo (PropertyForRent)
Solution:
Table:
staffNo(Registration) staffNo(PropertyForRent)
SG37 SA9
SA9 SG154
SG37 SG37
SL41 SL41
Solution:
Table:
branchNo
B002
B004
Solution:
Table:
fName lName
Susan Brand
John White
4 | Page
Branch Viewing
branchNo street city postcode
B002 56 Clover Dr London NW10 6EU
B003 163 Main St Glasgow G11 9QX
B004 32 Manse Rd Bristol BS99 1NZ
B005 22 Deer Rd London SWI 4EH
B007 16 Argyll St Aberdeen AB2 3SU
5 | Page
SL21 John White Manager M 10/1/1945 30,000.00 B005
SL41 Julie Lee Assistant F 6/13/1965 9,000.00 B005
6 | Page