开发者

Many to many relationship in erd

I am creating database for entertainment application. In this movies开发者_JAVA技巧,video songs,mp3 songs like entities are included. In this movie & actors,actresses,music directors,male singers, female singers have many to many relationships. i.e. an actor works in zero or many movies & a movie includes one or many actors. so my question is how to make these tables.


For example:

Actor Table:

  • ActorID
  • Actor Name

Film Table:

  • FilmID
  • FilmName

The Connection Table ActorFilm

  • ActorID
  • FilmID


Your actor table would look like:

[ actorID Name Age....]

Your movies table could look like

[ movieID Name release_date....]

where actorID and movieID are primary keys. Now the many-to-many relationship between them can be represented as another table say starring as:

[ movieID actorID ]

a row in this table implies that the movie with the given ID has the actor with actorID in that row as a star.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜