Jump to content

ENUM or separate table?


Guldstrand

Recommended Posts

What is the best way to store a few formats/types on different mass media?
Like "vhs", "dvd", "blu-ray" for movies or "lp", "cassette", "cd" etc for music.

Is it ok with an ENUM field with all types / formats or should I have a separate table just for these?
(I already have a table with all genres.)

Link to comment
Share on other sites

I am not a great fan of ENUM, preferring to have choices like your "media type" in a table with an id, and store the id in the data table as a foreign key.

Having such values in a table makes it easy to form a list of choices for the user, a task which is a PITA if the values are stored as enum.

Link to comment
Share on other sites

Every time you need a new format you'll have to modify your table schema. That's not a good thing.
There is no exhaustive list of formats you can rely on, which means you are coming up with this list on your own and deciding "yeah, I think that's all of them". That's not a good thing.
If there's 20 different media formats then you've got an ENUM with 20 different entries. That's not a good thing.

It's the same problem as you had with the list of genres.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.