0

First timer asking on Stack Exchange. I have a SQL query that returns 6 results in the terminal but does not work with check50 resulting in

"Query did not return any results"

I read in a similar question using to swop from using IDs to using the names of the actors instead. This does nothing to change the result in the VS code terminal but when I submit to check50 I still get the error.

The result I am expecting is

Alice Through the Looking Glass
Alice in Wonderland
Charlie and the Chocolate Factory
Corpse Bride
Dark Shadows
Sweeney Todd: The Demon Barber of Fleet Street

My code is here:

SELECT movies.title
FROM movies
INNER JOIN stars 
    ON stars.movie_id = movies.id
INNER JOIN people 
    ON people.id = stars.person_id
    WHERE people.id = 136
    INTERSECT
    SELECT movies.title
    FROM movies
    INNER JOIN stars 
        ON stars.movie_id = movies.id
    INNER JOIN people 
        ON people.id = stars.person_id
    -- HELENA BONHAM CARTER
    WHERE people.id = 307; 

Can anyone see any error in this code or is there something else I should consider.

1 Answer 1

1

Consider the potential problems that might result from hardcoding an id and running the query on a different database.

Hint: you know the name of the person to look for.

2
  • Thanks for this. If I understand this correctly is the assumption the ID could change while the name would not for these actors across databases? I've moved on to fiftyville to give myself a break from it but I am not having a Eureka moment with your clue. Though I do appreciate it.
    – DavidLS7
    Dec 1, 2021 at 20:20
  • Hint added to answer to hopefully trigger Eureka :) Dec 1, 2021 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .