Database design for lists

Noobsa44

Member
Jun 7, 2005
65
0
0
I’m attempting to develop a database which can store arbitrary lists of data and am looking for suggestions on design. What I want is to be able to have a list I can associate to other tables (such as a user) to a set of data points. I have simplified my current idea, but here is my current design:

DataListTable:
DataListId

DataElementTable:
DataListId, DataId, DataTypeId, DataValue, Description

Is there a better design or a more efficient way to design this? Thanks!
 

Train

Lifer
Jun 22, 2000
13,599
90
91
www.bing.com
What you are doing is called the "Entity-Value-Attribute" model, google that term for a wealth of information both for and against, advanages you can use, pitfalls to look for.

I've used it just fine on a number of occasions, but the main drawback is querying/reporting. If you are going to be accessing the data by ListID, you should be just fine.

Depending on your use cases, it may be benificial to have one or more dedicated columns for numbers. So instead of just a value column, have a txtValue, intValue, floatValue, etc. And you would know which column stores the data based on your dataTypeID, but this is small optimization that wouldn't net much gain in most scenarios
 
Last edited:

beginner99

Diamond Member
Jun 2, 2009
5,320
1,768
136
How arbitrary are these list? Are you sure you can't break the down in like 5 or 10 types of lists?

Another option would be something else than a RDBMS meaning either a document-oriented DB (CouchDb) or a GraphDatabase. Both of them allow storage of such arbitrary data much easier.