Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store Collection in MySQL

Status
Not open for further replies.

bazooqa

Programmer
May 8, 2007
1
US
Hi All,

I am new to MySQL and to DB in general, so I appreciate any help with this problem.

I have the following objects:
Article - Name, CreationDate, Auther, URL.
Users - FirstName, LastName, email, BirthDate.

I would like to create a favorite folder - so that each user can have a list of articles that are his favorites ones.

Each time the user login to the site he should see the list of his favorite articles.

In java I will save this list in a collection (e.g. Vector or Array). What is the best way to save it in the MySQL DB? Which data type should I use?

Thanks!
Bazoo.
 
For a many-to-many relationship (see the Paul Litwin article here: )

Just add an index field of type INT to each of your collections to define your tables. Names and URLs should be type VARCHAR, dates should type DATE:
Article - ArtID,Name, CreationDate, Auther, URL.
Users - UserID,FirstName, LastName, email, BirthDate.
Create a Favorites table - FavID, UserID, ArtID

You will find all the MySQL documentation here: - make sure you use the right version!

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top