9628001
9628001

Reputation: 529

How to express queries in Tuple Relational Calculus?

Problem:

Consider a relation of scheme Building(Street, Number, No.Apartments, Color, Age). 
TRC: find the oldest building in Downing Street. 

The associated SQL statement would be:

SELECT MAX(Age) AS ‘Oldest building’, Street FROM Building WHERE Street = ‘Downing Street’;

My answer using TRC: (B stands for Building relation)

{V.*|V(B) | V.BAge >=Age ^ V.Bstreet = ‘Downing Street’}

V.* (it returns evry single tuple of Building)

V(B) (it maps variables V to Building’s tuples)

V.BAge >=Age ^ V.Bstreet = ‘Downing Street’(here I set the condition…maybe..)

Upvotes: -1

Views: 395

Answers (1)

Alexander Serebrenik
Alexander Serebrenik

Reputation: 3577

If this is still relevant: the hint would be to realize that the oldest building is the one such that no other building is older than it.

Upvotes: 1

Related Questions