【发布时间】:2012-01-04 07:55:02
【问题描述】:
我不是数据库专家,这肯定是一个新手问题。
我有一个包含电影数据的 SQLite 数据库。
主表(movies)包含:
- movie_id(自动增量,主要);
- 标题;
- 年;
- 其他字段;
然后我有 actors 表:
- actor_id(自动增量);
- 姓名;
- 姓;
然后我有 cast 表:
- movie_id(与电影表相关);
- actor_id(与演员表相关,例如 Robin Williams);
- character_name(角色的名字,例如“Mrs Doubtfire”);
在单个查询中,我应该检索给定电影的所有角色(在应用程序级别,我有要开始的当前电影的 id)、演员的姓名和电影列表 (!=这部当前的电影)该演员扮演的角色:
Character_name | Actor | Other movies where we've seen this actor
Mrs Doubtfire | Robin Williams | Mork & Mindy, Dead Poets Society, ...
Other name | Other actor | Related movies,...
这可能吗?怎么样?
【问题讨论】: