我有一个演员电影数据库,我必须选择演员,导演以及在大多数不同国家制作电影的人。这是我的架构:
电影(id_movie,title,id_director(FK),年份,持续时间,国家/地区,facebook_likes,imdb_score,毛重,预算)
Actor_Movie (id_actor(FK),id_movie(FK))
人(id_person,name,facebook_likes)
演员(id_actor(FK))
总(id_director(FK))
这就是我所做的,但我没有得到我期望的结果:
SELECT p.name
FROM Person AS p
, Movie AS m
, Actor AS a
, Director AS d
WHERE p.id_person = m.id_director
AND p.id_person = a.id_actor
AND p.id_person = d.id_director
GROUP
BY m.country
ORDER
BY COUNT(DISTINCT m.country) DESC
LIMIT 5;
谢谢!