SQL table items, self referring to each other
Posted: Tue Aug 16, 2011 2:11 am
I'm trying to figure out how best to implement something in a sqlite database...
let's say I have 10 items in a table
each of these items is related to other items in the same list (only once each), but could have none, some, or all.
without creating a separate table for each item, how can I implement the relationship list for each item?
Keeping in mind, that the relationship list for each item is/can be completely random, and unrelated to the order of any other item's relationship.
And there is an infinite number of items, so I can't simply keep creating more tables and/or columns.
let's say I have 10 items in a table
Code: Select all
0 item1
1 item2
2 item3
3 item4
4 item5
5 item6
6 item7
7 item8
8 item9
9 item10without creating a separate table for each item, how can I implement the relationship list for each item?
Code: Select all
0 item1 -> 1,2,3,4,5,6,7,8,9
1 item2 -> 0,2,3,4,
2 item3 -> 5,6,7,8,9
3 item4 -> 0,1,7,8,9
4 item5 -> 1,2,3,5,6,7,8,9
5 item6 -> 8,9
6 item7 ->
7 item8 -> 2
8 item9 -> 0,1,2,3,4,9
9 item10 -> 0,1,2,3,4,7,8And there is an infinite number of items, so I can't simply keep creating more tables and/or columns.
