Database Design: How should I store user's news preferences in MySQL database?

285 views Asked by At

I'm trying to implement a personalized news aggregator. I have to save user's preferred news sources in db. Should I store all the news sources liked by a user as JSON string and then decode it after retrieving?

feeds | user

or have individual column for each news source(no of news sources would be around 200)?

feed_name1 | feed_name2 | .....  | user
1

There are 1 answers

1
John On BEST ANSWER

Sounds like a many-to-many situation. A solution that used a person table, a newsfeed table, and a person_newsfeed table might be appropriate. There are lots of articles on line about this and any good database theory book (or Something like Oracle: The Complete Reference) should cover this in detail.

This article is a pretty good (but very short) summary: http://www.databaseprimer.com/pages/relationship_xtox/

Oracle8 The Complete Reference covers this around page 35 with the worker, skill, workerskills example during their discussion of third normal form.