通过了解SQL脚本

时间:2017-02-07 19:46:48

标签: sql database

我是SQL的新手,我很难解决以下问题:

我有这个关系表:

Movie (CodMov, Title, ProductionYear, Nationality, Director, Genre)

我如何找到"电影片名"在SQL脚本中指导" X"的同一导演制作的所有电影?

谢谢。

2 个答案:

答案 0 :(得分:3)

您可以使用子选择

select Title
from Movie 
where Director = ( select Director from Movie
                    where Title = 'X')

答案 1 :(得分:2)

select Title 
from Movie 
where Director = (select Director from movie where Title = 'X')