Mysql 列出';哈里森·福特';出现

Mysql 列出';哈里森·福特';出现,mysql,sql,sql-server,Mysql,Sql,Sql Server,为什么这个问题的答案不正确 数据库 movie (id(PK), title, yr, director(FK), budget, gross) actor (id(PK), name ) casting (movieid(PK, FK), actorid(PK, FK), ord) 问题:列出《哈里森·福特》曾出演过的电影 我的答覆是: select title from movie were id IN ( select movieid as i

为什么这个问题的答案不正确

数据库

movie (id(PK),  title,  yr,     director(FK),   budget,     gross)
actor (id(PK),  name )
casting (movieid(PK, FK),   actorid(PK, FK),    ord)
问题:列出《哈里森·福特》曾出演过的电影

我的答覆是:

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

更正
后,were
->
where
并删除尾部的
X
正确的语法和结果

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'
    )
)
错误消息表明它正在使用MariaDB

    select title from movie inner join casting on (movie.id = casting.movieid)
    inner join actor on (casting.actorid = actor.id)
    where actor.name = 'Harrison Ford'

请在SQL Zoo上使用上述SQL代码回答此问题;这是与“更多加入”相关的练习。因此,您应该使用联接来解决它

MySQL或SQL Server?我们需要查看示例数据和预期结果。WARE!=哪里可以找到答案。为什么这个问题的答案不正确?“你怎么知道它是错的?”丹布莱克我用连接解决了它。但我想在没有加入的情况下尝试一下。我想知道为什么这个子查询不起作用谢谢@danblack。我想我在发布这个问题时没有纠正where的拼写。问题实际上在于我移除的尾部X,现在它工作了