【发布时间】: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
如何为以下查询编写关系代数表达式?
select Customer_ID
from tbl_Reservation
where Customer_ID not in (select Customer_ID from tbl_Bill)
【问题讨论】:
标签: sql tsql relational-algebra
类似这样的:
excludedCustomers = π(Customer_ID)(tbl_Bill)
customerReservations= π(Customer_ID)(tbl_Reservation)
result = customerReservations- excludedCustomers
您只需要获取要排除的客户的预测(全部来自 tbl_Bill),对 tbl_Reservation 执行相同操作,然后从两个预测中减去即可。
【讨论】: