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

发布于 2024-12-06 19:02:58 字数 621 浏览 0 评论 0原文

问题:

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 代表 Building 关系)

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

V.*(它返回 Building 的每个单个元组)

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

V.BAge >=Age ^ V.Bstreet = 'Downing Street'(这里我设置了条件……也许……)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软糖 2024-12-13 19:02:58

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文