Reputation: 54
I'm designing my database structure. I need to save multiple IDs like this:
8694564795903436667,18280427823078344486,15033597879242900284,17492244717654560088
What would be the best datatype for this? I need to index it too.
Upvotes: 0
Views: 2303
Reputation: 2553
Based on the data you specified that you wish to store, you have no choice but to use a varchar or text datatype. HOWEVER, I highly encourage you to rethink your database design because storing multiple IDs in one field is a very poor design.
Use the strength of what a database is built for, storing data in a cell that can be mapped to other records/tables with proper use of relationships.
Upvotes: 1
Reputation: 204924
If you are sure your number can't get bigger than 18446744073709551615
, then you can use the UNSIGNED BIGINT data type.
Otherwise use a varchar
data type.
Upvotes: 1