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

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

DataBase movies.db

tables

directors (movie_id, person_id)

movies (id, title, year)

people

5条回答
  •  有刺的猬
    2020-12-11 14:30

    I found these steps helpful:

    1. Get the ID of Kevin Bacon, with the criteria that it's the Kevin Bacon who was born in 1958
    2. Get the movie IDs of Kevin Bacon using his ID (hint: linking his ID in table1 with table2)
    3. Get other stars' IDs with the same movie IDs
    4. Get the name of these stars, and exclude Kevin Bacon (because the spec says he shouldn't be included in the resulting list)

    Note: In the first line of your code, instead of COUNT(name), you can use SELECT name to get the people's names

提交回复
热议问题