sujoy
January 23rd, 2009, 07:47 PM
i need an entity's attribute to have multiple values. like say movie genre.
a movie can have multiple genre, a genre can be found in multiple movies, so whats the most efficient way to design the database for it?
i need to able to list all the genre given a movies name as well as list all the movies given the genre.
from what i understood, one way would be
to create a movie table, with id, name, year, director, etc.
to create a genre table with id, genre name.
and then,
to create another table with movie_id and genre_id.
is this an appropriate method of doing it? genre is just an example, directors, cast, alternate names, languages,..... many things will be multi valued for a movie db
a movie can have multiple genre, a genre can be found in multiple movies, so whats the most efficient way to design the database for it?
i need to able to list all the genre given a movies name as well as list all the movies given the genre.
from what i understood, one way would be
to create a movie table, with id, name, year, director, etc.
to create a genre table with id, genre name.
and then,
to create another table with movie_id and genre_id.
is this an appropriate method of doing it? genre is just an example, directors, cast, alternate names, languages,..... many things will be multi valued for a movie db