Skip to main content
added 6 characters in body
Source Link
James Z
  • 12.3k
  • 10
  • 26
  • 46

I have a SQLite table named User. Each User has a primary UserID and multiple SecIDs (all integers). The SecIDs are stored in CSV format as a single field (type is String). For example, suppose User1 has SecIDs as 4,5,6,7 and User2 has SecIDs as 8,9,55,66.

So for User1 :-
UserID = 1
SecIDs = "4,5,6,7"
And for User2 :-
UserID = 2
SecIDs = "8,9,55,66" (And so on)

Now my question is- I have a particular SecID say 5. And I have to extract the UserID corresponding to that (which is 1). So what would be the Query for this operation?

P.S- There could be lakhs and lakhshundreds of thousands of User Records in my SQLite table. So the search query should be an optimized for minimum time consumption.

I have a SQLite table named User. Each User has a primary UserID and multiple SecIDs (all integers). The SecIDs are stored in CSV format as a single field (type is String). For example, suppose User1 has SecIDs as 4,5,6,7 and User2 has SecIDs as 8,9,55,66.

So for User1 :-
UserID = 1
SecIDs = "4,5,6,7"
And for User2 :-
UserID = 2
SecIDs = "8,9,55,66" (And so on)

Now my question is- I have a particular SecID say 5. And I have to extract the UserID corresponding to that (which is 1). So what would be the Query for this operation?

P.S- There could be lakhs and lakhs of User Records in my SQLite table. So the search query should be an optimized for minimum time consumption.

I have a SQLite table named User. Each User has a primary UserID and multiple SecIDs (all integers). The SecIDs are stored in CSV format as a single field (type is String). For example, suppose User1 has SecIDs as 4,5,6,7 and User2 has SecIDs as 8,9,55,66.

So for User1 :-
UserID = 1
SecIDs = "4,5,6,7"
And for User2 :-
UserID = 2
SecIDs = "8,9,55,66" (And so on)

Now my question is- I have a particular SecID say 5. And I have to extract the UserID corresponding to that (which is 1). So what would be the Query for this operation?

P.S- There could be hundreds of thousands of User Records in my SQLite table. So the search query should be an optimized for minimum time consumption.

Source Link

search operation for CSV field sqlite

I have a SQLite table named User. Each User has a primary UserID and multiple SecIDs (all integers). The SecIDs are stored in CSV format as a single field (type is String). For example, suppose User1 has SecIDs as 4,5,6,7 and User2 has SecIDs as 8,9,55,66.

So for User1 :-
UserID = 1
SecIDs = "4,5,6,7"
And for User2 :-
UserID = 2
SecIDs = "8,9,55,66" (And so on)

Now my question is- I have a particular SecID say 5. And I have to extract the UserID corresponding to that (which is 1). So what would be the Query for this operation?

P.S- There could be lakhs and lakhs of User Records in my SQLite table. So the search query should be an optimized for minimum time consumption.