我的问题是:11题和13题,都是有两个变量,为什么第11题不需要用子查询,而第13题需要?
-- # 11. List the films together with the leading star for all 1962 films.
SELECT movie.title, actor.name
FROM movie
JOIN casting
ON casting.movieid = movie.id
JOIN actor
ON actor.id = casting.actorid
WHERE movie.yr = 1962
AND casting.ord = 1;
-- # 13. List the film title and the leading actor for all of 'Julie
-- # Andrews' films.
select title, name
from movie
join casting
on (movieid=movie.id and ord =1)
join actor
on (actorid=actor.id)
where movie.id in
(select movieid from casting
where actorid in
(select id from actor
where name = 'Julie Andrews'))