Im doing a test exam where I've gotten stuck on one particular query, in both its SQL code, relational algebra and tuple relational calculus.
The query states:
Find the (city,state) pairs which house a branch of every type which is listed in the Branch
relation.
Where Branch
is:
Branch_ID (Primary key)
Branch_City
Branch_State
Branch_Type
and City is:
City_Name (Primary key)
State_Name (Primary key)
Population
And Branch_City
and Branch_State
is a foreign key to City_Name
and State_Name
respectively.
The "rules" are that aggregate functions, such as COUNT
,MAX
etc may not be used.
The query must be "understood" by MySQL and PostgreSQL however functions like EXCEPT
, INTERSECT
available in PostgreSQL but not in MySQL can be used.
No subqueries in the FROM
clause
As said, it would be greatly appreciated if answers could be provided for sQL, relational algebra and tuple relational calculus. Those questions has stalled me.
Thanks in advance!