Skip to content
Advertisement

List the films in which ‘Harrison Ford’ has appeared

Why is the answer to this question incorrect?

Database

movie (id(PK),  title,  yr,     director(FK),   budget,     gross)
actor (id(PK),  name )
casting (movieid(PK, FK),   actorid(PK, FK),    ord)

Question: List the films in which ‘Harrison Ford’ has appeared

My answer:

select title
from movie
were id IN
(
    select movieid as id
    from casting
    where actorid IN 
    (
        select id as actorid
        from actor
        where name = 'Harrison Ford'
    )
) X

Advertisement

Answer

After correcting were -> where and removing the trailing X the syntax and result where correct.

select title
from movie
where id IN
(
    select movieid as id
    from casting
    where actorid IN 
    (
        select id as actorid
        from actor
        where name = 'Harrison Ford'
    )
)

Error message indicated it was using MariaDB

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement