【问题标题】:how to write a relational algebriac expression for the following query?如何为以下查询编写关系代数表达式?
【发布时间】:2012-04-16 16:46:54
【问题描述】:

如何为以下查询编写关系代数表达式?

select Customer_ID
from tbl_Reservation
where Customer_ID not in (select Customer_ID from tbl_Bill)

【问题讨论】:

    标签: sql tsql relational-algebra


    【解决方案1】:

    类似这样的:

    excludedCustomers = π(Customer_ID)(tbl_Bill)
    customerReservations= π(Customer_ID)(tbl_Reservation)
    result = customerReservations- excludedCustomers
    

    您只需要获取要排除的客户的预测(全部来自 tbl_Bill),对 tbl_Reservation 执行相同操作,然后从两个预测中减去即可。

    【讨论】:

      猜你喜欢
      • 2021-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-07
      • 2021-05-01
      相关资源
      最近更新 更多