Take the 2-minute tour ×

I'm currently developing a web application using MYSQL database InnoDB format and need some help with my preference database desgin.

Basically I need to have a preference table to determine the user car brand preference.

BMW 0 or 1 TOYOTA 0 or 1 HONDA 0 or 1 MERCEDES 0 or 1 HOLDEN 0 or 1 FORD 0 or 1 (0 means dislike and 1 means like)

I used to store all the responses in one table but is hard to maintain when I add new car brand . So I need to make it dynamic so I don't have to modify the database column when i add more car brands.

So Each User in my system have their own user's car preference profile.

So my new design its to have a user table, preference table and a UserPreference table

UserPreference table


My Question is How can I populate the User preference profile rows in the database (default all to 0) once a new user sign up ?

Or should I make my UserPreference table like below so I don't have to populate the user preference profile rows? And only create a row in the User Preference table when a user like a car brand.

Which is a better approach?

UserPreference table


Thanks so much in advance!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I think the second approach is the best option, Only add the preferences that people have explicitly chosen. That way you can assume when working with the data that everything is 0 unless a preference exists in the table to show otherwise.

share|improve this answer
add comment

Your Answer


