Copyright © T. H. Merrett
308-420A Secondary Storage Algorithms and Data Structures Week 10
Assignment 10
Using relix and the cars database, consisting of two relations,
CARS(REG,NAME,MODEL,COLOUR,YEAR)
TBOOK(NAME,ADDR,FONE)
write relational algebra statements to find the answers to the two queries:
1. Get names of owners of yellow cars.
2. Get addresses of owners of yellow cars.
jRelix
relix current directory contains (will contain) database
NB use an empty directory or a directory with a relix DB.
commands
trace;
pr ;
sr; sr ;
sd; sd ;
dr ;
dd ;
srd;
input ""; NB no *, ~
trace;
quit;
declarations
domain {bool ! intg ! short ! real ! strg};
relation () [<- {( ,.., ),..,( ,.., )}];
relational algebra
<- ;
[ <- ] ;
::= !
[] where in !
[ ijoin ]
GUIDE
1. start relix.
2. input "/home/course/cs420/carsdb/gencarsdb";
(you might do a %vi on this file to find out what it does)
3. formulate your relational algebra expressions for the queries.
4. pr the result for each query.
5. hand in .trace from a working run (or run it with script).
Shared marks for shared work: assignments should be your own work; marks
for joint assignments will be divided by the number of collaborators.
But please feel free to work in groups to learn or for extra work that
is not for marks.