1

Ok so I am designing a database for my website I am making, which will host information about different things, (a bit like IMDb).

I will have 'movie' pages, 'tv' pages & pages for 'actors', 'directors' and possibly writers.

Now I originally came up with something along the lines of this:
Film {
MediaID: #One media type (film/tv) will have one ID
Description: #One film will have one description
Cert.UK:
Cert.US: #One film may have a certificate for each country
IMDb: #One film will have one IMDb rating
Duration: #One film will have one duration
Release: #One film will have on release
Genre: #A movie may belong to multiple genres
People.ActorID #One film may have multiple actors
People.DirectorID #One film may have multiple directors
Image: #One film will have one image
Trailer: #One Film will have one trailer
}

Cert {
UK:
US:
}

People {
PeopleID: #One person will have one ID
Role: #A person may have multiple roles
Film.MediaID: #A person may belong to multiple films
Name: #One person will have one name
DOB: #One person will have one Date of Birth
Description: One person will have one description
}

For the case of MediaID in Film; both Film and Tv tables will share MediaID as their primary keys, and I don't want to make a Media table and add Type:Film/TV as they require different columns leaving alot of unncecesary null data. Is it ok to leave that as is?

Also: When adding a new film, how can I make sure it's MediaID doesn't already exist?
When there is a one to many relationship do I need to create a new table? For example I thought about creating a roles and genre table but would that be necessary?

Reality
  • 21
  • 6
  • If you have Film and Tv sharing ID then yes it is common to separate the key out to a separate table, let the DB auto-assign a value on insert, use that key as a foreign key in your other tables. – No Refunds No Returns Oct 12 '16 at 00:47
  • Your question may have an answer here: http://stackoverflow.com/questions/13749525/relational-database-design-multiple-user-types/13752304#13752304 – Walter Mitty Oct 12 '16 at 04:42

0 Answers0