对于pset7 Q13问题,我的SQL代码正在返回错误:
Result: ambiguous column name: id
At line 1:
不应该这样,因为有一个列名是“ id”。
Q13: 在13.sql中,编写一个SQL查询,以列出曾在凯文·培根也曾出演过电影的所有人的名字。
SELECT name FROM people, stars WHERE people.id = stars.person_id AND stars.movie_id IN (SELECT id FROM movies, stars, people WHERE movies.id = stars.movie_id AND stars.person_id = people.id AND name = "Kevin Bacon" AND birth = 1958);
已更新:
SELECT name FROM people, stars WHERE people.id = stars.person_id AND stars.movie_id IN (SELECT movies.id FROM movies, stars, people WHERE movies.id = stars.movie_id AND stars.person_id = people.id AND name = "Kevin Bacon" AND birth = 1958) AND name != "Kevin Bacon";