我正在修改数据库课程,我从过去的作业中有以下问题,我不确定我是否有正确的答案。这是问题:
The database schema is as follows:
• LIKES(drinker,beer);
• FREQUENTS(drinker,bar);
• SERVES(bar,beer,cost);
• Bars can serve many beers, drinkers can frequent many bars, and they can like many beers.
However, a bar cannot serve the same beer at different costs.
Write the following query in relational calculus: Find bars that serve at least one beer liked by Joe, but do not serve any beer liked by
Michael.
这是我所拥有的:
{P | ∃L1 ∈ LIKES ∃L2 ∈ LIKES ∃S ∈ SERVES(L1.drinker='Joe' ^ S.beer = L1.beer ^ L2.drinker = 'Michael' ^ L1.beer != L2. beer ^ P.bar = S.bar)}
这看起来好吗?谢谢