In sql, what is the best way to store multiple ordered vectors / lists?

I have several whole lists of different lengths that I want to keep. I will use them as an alternative to each other, and not 2 at the same time. The number of lists may increase in the future, although I expect it to never reach the level of 50 or so. I might want to insert one value into this list. These lists are relatively rarely changed, and for this a manual editor is used, such as MS SQL Server Management Studio. For what I see at this moment, these lists are rarely used to directly create queries, there will be C # between them.

For storing a single ordered list, a suitable (or double) list seems appropriate. But if I need to store several ordered lists, it seems to me that I will have to add one table for each of them. The same is true if I use an indexed list. On the other hand, I could also store all of these lists in one table, converting them to strings (one row per list) with comma separated values, which I then analyzed in my C # program.

In sql, what is the best way to store multiple ordered vectors / lists in sql?

+4
source share
2 answers

, SQL Server, , "" "" - - . - , SQL Server, - ..... - ... ! ( SQL Server - ).

- , , - - . - , - - - !

+8

?

ListId   ItemOrder ItemValue
1        1         10
1        4         7
1        2         5
2        1         55
1        7         23
2        4         15

Select ItemValue FROM [Table] WHERE ListId = 1 Order By ItemOrder

( ), ItemOrder

+2

Source: https://habr.com/ru/post/1606419/


All Articles