Reputation: 955
I have the following relational database:
**Company** (company-name, address, grade, last-year-profit)
**Agent-of** (agency-name, company-name)
**Agency** (agency-name, city)
**Manager** (company-name, manager-name)
Now I want to find the address of the company that has more than 8 agents (ie. agencies acting as it's agent).
How would I do this? I don't understand how to count the agencies and then select based on this count. Or is my thinking wrong?
Upvotes: 0
Views: 2955
Reputation: 18408
The most common versions of relational algebra do not support aggregations (e.g. counting tuples) (but note that mileage may vary).
Without aggregations, your problem can still be answered by resorting to an 8-way self-join :
Upvotes: 2