【发布时间】:2009-10-22 00:04:24
【问题描述】:
大家好,我很难正确措辞,这就是为什么我在网上找不到答案的原因,所以我能做的最好的就是举个例子。我有以下数据库表:
ACTORNAME SERIESNAME
------------------------------ ------------
baldwin found
baldwin lost
baldwin rocks
baldwin sienfield
costelo friends
costelo prince
costelo remember
denzel friends
denzel prince
denzel remember
fox found
fox friends
fox prince
lopez found
lopez friends
lopez prince
lopez remember
pitt er
pitt everybody
pitt friends
pitt heroes
pitt rocks
smith friends
smith prince
smith remember
我想使用一个 SELECT 语句来获取在 smith 播放的所有同一系列中播放的演员姓名。因此,生成的演员姓名应该是:
科斯特洛、丹泽尔和洛佩兹
我什至不确定要使用哪个关键字。我正在查看 JOIN 命令并尝试了 MINUS,我能得到的最接近的是与 smith 播放的系列完全相同的演员名称(在这种情况下,洛佩兹不包括在内,而且是错误的)
这里有另一种解释:
suppose Smith acts in movies X and Y.
Suppose also that actor
A acts in movies X, Z
B acts in Y
C acts in X, Y, Z
D acts in X, Y
The answer to the query should be actors C and D.
换句话说,你必须返回那些电影中包含演员史密斯的演员。
寻找正确方向的推动力, 托梅克
【问题讨论】: