MySQL Forums
Forum List  »  Newbie

database design
Posted by: Ben Vaughan
Date: April 05, 2005 12:15AM

Hi everyone,

I'm new to database design and was looking for a solution to a problem i've encountered. Ok so i'm designing an application that has users and they tell us what types of drinks they like.

So each user clicks on checkboxs on a web form next to the drinks they like, coke, water, whiskey, etc. Now i'm not sure how to store this data.

I have a list of all the different types of drinks and I have a list of users. In the future I may want to add new drinks to the list (eg. a new softdrink comes on the market). I think it would be bad to have one field in a users table for each drink type and then put true/false in it as this seems like a waste of data space and if I add more drinks I need to add extra fields to my users table, which doesn't seem good.

The only other approach I can think of is to have a separate table with a column for each drink and one for a user id. Each row would be a user and have their drink preferences in it. Again the need to add extra drink types later on would require adding extra fields to this table, which just seems like poor design.

If anyone has any ideas on how I can better achieve this I would really appreciate your input.

Thanks,
Ben.

Options: ReplyQuote


Subject
Written By
Posted
database design
April 05, 2005 12:15AM
April 05, 2005 12:34AM
April 05, 2005 08:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.