is better to use ENUM or separate table to get list from possible values (eg html select)?
What is better practice?
when i use SHOW COLUMNS, enum type must by parsed;
OR
when i use separate table to store possible values and use SELECT * ???
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you use enum, you are actually hardcode your list in the database table. So if you need to add something you will need to go and alter the table. On the other hand, when you use a table that you are connecting it through foreighn key, you can add easily a keyword (choice) from the front end application without the need to alter your schema.
I prefer to use enum when the choices are not subject to change and the table with the foreign key relationship when my list is changing over time. Choice is yours.
I hope that this is helpful for you.