Author |
Topic |
|
e3stone
Average Member
USA
885 Posts |
Posted - 02 May 2001 : 12:10:56
|
I'm building a db table(s) to store information about movies that are being shown at local theatres. I can't decide what the best table set-up would be. Here's my idea. Have one table that stores the Theatre info (name, address, tele, etc), then have another table that stores movie details (name, rating, actor/actresses, length, director, etc) Now, the key point that I'm stuck on is what would be the best way to link the individual movie to the theatre? have a seperate table that has a "theatre_id" and "movie_showing_id" fields?? or should I have a yes/no field in the movie detail table, i.e. have a field called "starplex" (a type of theatre) and check yes if the movie is playing there? Any ideas that would point me in the right direction would be great
<-- Eric -->
http://insidewaco.com/forum |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 May 2001 : 12:33:21
|
since this is likely to be a many to many relationship, you should use a link table to store the theatre/movie id's
|
|
|
davemaxwell
Access 2000 Support Moderator
USA
3020 Posts |
Posted - 02 May 2001 : 13:22:30
|
Like Huw suggest, I would use something like this:
Theatre: TheatreID, Name, Type, Seats, etc...
Movie: MovieID, Name, Rating, Length, etc...
Movie_Theatre: TheatreID, MovieId
This is very similar to the way forum_moderators is set up currently....
Dave Maxwell -------------- Proud to be a "World Class" Knucklehead |
|
|
e3stone
Average Member
USA
885 Posts |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 May 2001 : 15:28:40
|
you would be best to store this in a seperate table and have it's id in the link table, since it is specific to a particular movie/ theatre
so your link table would be
theatreid/movieid/screentimeID
I would do it this way since the number of screenings will vary depending on the theatre/movie combination
|
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 02 May 2001 : 16:49:13
|
Alright, so my relationship table should look like this?: http://insidewaco.com/movie_database.gif
I'm just learning about database design and details of relationship within them. What exactly is the link table for? are each of the fields in the link table a primary key of that table? So, in this example the link table would have three primary keys?
<-- Eric -->
http://insidewaco.com/forum |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 May 2001 : 18:10:42
|
looks good, basically the link table is used when you have a many to many relationship, to store those relationships it allows you to define things like
a movie can be shown in multiple theatres and a theatre may show multiple movies, by simply storing the links, and yes you are correct every record in the link table will be unique and have a "three field" primary key definition
|
|
|
|
Topic |
|