Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database structure

 
Jens Erik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have decided to use a database (java DB) to store my data. My model is a key-value structure with List as value, and the size is arbitrary. My question is how to store arbitrary sized data into a table in my db. Do I need to add/remove columns, keeping track of that in my code, or is it simply something better/automatic supported in the DB?

If I store the List as is, then I cannot use db to search/sort etc which I was hoping to.

Specifically I need to store ArrayList<Amount> values. (Amount=Measure)


Regards
Jens
 
Scott Selikoff
author
Saloon Keeper
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add another table with two (or more) columns, where the first column is a key back to your original data and the second column is a value.

Usually when the words "arbitrary (large) size" come up, its an indication your structure should be grouped to support a fixed number of columns with an arbitrary number of rows. Generally in the database world, table structure (especially columns) are not modified in active systems.
 
Jens Erik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your answer. I thought about the first strategy myself, but admit it seem a little fuzzy.

I will try your other advice. If I understand you correct, this means creating a new Table every time I need to increase/decrease number of columns.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic