如何在元组关系演算中表达查询?

时间:2011-09-28 09:11:30

标签: tuple-relational-calculus

问题:

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

关联的SQL语句为:

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

我使用TRC的答案:(B代表建筑关系)

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

V.*(它返回建筑物的evry单元组)

V(B)(它将变量V映射到Building的元组)

V.BAge >=Age ^ V.Bstreet = ‘Downing Street’(这里我设定条件......也许..)

1 个答案:

答案 0 :(得分:1)

如果这仍然是相关的:提示将意识到最古老的建筑物就是没有其他建筑物比它更古老的建筑物。