```Copyright ©  T. H. Merrett

308-420A          Secondary Storage Algorithms and Data Structures       Week 10

Assignment 11

Using relix and the cars database from Asst. 10, consisting of two relations,

CARS(REG,NAME,MODEL,COLOUR,YEAR)

write domain algebra statements to find the answers to the two queries:

1. For each colour of car, find the number of cars of that colour.

2. Find the average number of telephone numbers per person.

relix

domain algebra
let <ident> be <horiz expr>;
let <ident> be red <ass-com-op> of <dom expr>;
let <ident> be equiv <ass-com-op> of <dom expr> by <dom-list>;
let <ident> be fun <fun-par-op> of <dom expr> order <dom-list>;
let <ident> be par <fun-par-op> of <dom expr> order <dom-list> by <dom-list>;

<ass-com-op>::= + ! * ! & ! | ! max ! min
<fun-par-op>::= <ass-com-op> ! - ! / ! mod ! ** ! cat ! pred ! succ !
<horiz op>::= <fun-par-op but not pred, succ> ! < ! <= ! = ! >= ! > ! ~= !
if..then..else.. ! abs ! cos ! sin ! tan ! log10 ! log ! ln !
atan ! acos ! asin ! tanh ! cosh ! sinh ! isknown !
round ! ceil ! floor ! ord ! chr
(function arguments in parentheses, e.g., abs(A))

<bool>::= true ! false ! dc ! dk        <<ascii rep. of true: 1; false: 0>>
<intg>::= <digit>+ ! dc ! dk            <<ascii rep. of dc: ^E;  dk: ^B>>
<strg>::= "<alphameric>+" ! dc ! dk     <<ascii rep. of end item: ^F>>
<real>::= <digit>* . <digit>* E [+,-] <digit>+ ! dc ! dk

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.
```