CS50 Pset 7 13.sql, I can't solve it, nested sqlite3 database

后端 未结 5 884
感动是毒
感动是毒 2020-12-11 14:10

DataBase movies.db

tables

directors (movie_id, person_id)

movies (id, title, year)

people

5条回答
  •  [愿得一人]
    2020-12-11 14:26

    I try the steps in Zara answer:

    SELECT people.name
    FROM people
    WHERE people.id = (
        SELECT stars.person_id
        FROM stars
        JOIN movies ON stars.movie_id = movies.id
        WHERE movies.id = (
            SELECT movies.id
            FROM movies
            JOIN stars ON stars.movie_id = movies.id
            JOIN people ON stars.person_id = people.id
            WHERE people.id = (
                SELECT id
                FROM people
                WHERE birth = 1958 AND name = "Kevin Bacon")
                        )
    )
    

    Result:

    I must have done the wrong steps to get this result

    Expected 176 rows but got one row "Steve Guttenberg"

提交回复
热议问题